/* /apply: the space application, in Manuscript's ink-on-paper style */

:root {
  --muted: #6f6a61;
  --faint: #a8a296;
  --error: #9a3324;
}

.apply-main {
  display: block;
  padding: 0;
}

/* One long page: every question stacked, top to bottom */
.apply {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 40px 120px;
}

/* The title and note at the top of /events and /guests */
.apply__intro { margin-bottom: 72px; }
.apply__title {
  margin: 0;
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 700;
  line-height: 1.05;
}
.apply__intro .apply__hint { margin-top: 18px; max-width: 34em; }

/* /members: two hand-drawn cards, one per form, centred in the frame */
.members {
  position: relative; z-index: 1;
  width: 100%; max-width: 860px;
  padding: 72px 40px;
  text-align: center;
}
.members > .apply__hint { margin-top: 16px; }
.members__cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
  text-align: left;
}
.members__card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 220px;
  padding: 32px 32px 28px;
  color: var(--fg);
  text-decoration: none;
  transition: color .2s;
}
.members__card .sketch-line { stroke: #8f8a80; transition: stroke .2s; }
.members__card .sketch-fill { fill: rgb(243 238 228 / .6); opacity: 1; transition: fill .2s; }
.members__card:nth-child(2) .sketch { transform: scaleX(-1); }
.members__card > span { position: relative; }
.members__name { font-size: clamp(26px, 2.6vw, 32px); font-weight: 700; line-height: 1.1; }
.members__text { margin-top: 12px; color: var(--muted); font-size: 17px; line-height: 1.5; transition: color .2s; }
.members__go { margin-top: auto; padding-top: 24px; font-size: 24px; line-height: 1; transition: transform .2s; }
.members__card:hover { color: var(--bg); }
.members__card:hover .sketch-line { stroke: var(--fg); }
.members__card:hover .sketch-fill { fill: var(--fg); }
.members__card:hover .members__text { color: #cfcac0; }
.members__card:hover .members__go { transform: translateX(6px); }
.members__card:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.members .apply__help { margin-top: 40px; }

/* /guests: one block per guest, then "Add another guest" */
.guests { display: flex; flex-direction: column; gap: 0; margin-top: 72px; }
.guest {
  position: relative;
  padding: 48px 0 72px;
  border-top: 1px solid var(--stroke);
}
.guest__label { margin: 0 0 40px; font-size: clamp(26px, 2.6vw, 32px); font-weight: 700; line-height: 1.1; }
.guest__remove {
  position: absolute; top: 56px; right: 0;
  padding: 0; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 17px;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.guest__remove:hover { color: var(--fg); }
.guest__remove[hidden] { display: none; }
.guests__add { margin-top: 0; }
.guests__add[hidden] { display: none; }
.guests__limit { margin-top: 20px; }
.guests__limit a { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.apply__hint strong { color: var(--fg); font-weight: 700; }
/* Terms as short points above the agree box */
.apply__terms { margin-bottom: 0; padding-left: 1.1em; }
.apply__terms li + li { margin-top: 6px; }

/* The pop-up after an /events or /guests submission (form.js showNotice) */
.notice {
  width: calc(100% - 32px); max-width: 460px;
  /* Extra room top and bottom: the sketched edges sit about a tenth of the way in */
  padding: 52px 40px 44px;
  border: 0; background: transparent; color: var(--fg);
  overflow: visible;
  animation: apply-done .45s cubic-bezier(.2,.7,.2,1);
}
.notice::backdrop { background: rgb(243 238 228 / .75); }
.notice > .sketch .sketch-fill { fill: var(--bg); opacity: 1; }
.notice > :not(.sketch) { position: relative; }
.notice .apply__question { margin: 0; }
.notice .apply__hint { margin-top: 14px; }
.notice .apply__hint a { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.notice .apply__button { margin-top: 28px; }
/* The guest terms, after the guests and above Submit */
.apply__fields--after { margin-top: 72px; padding-top: 48px; border-top: 1px solid var(--stroke); }

.apply__fields, .apply__fold-inner {
  display: flex; flex-direction: column;
  gap: 72px;
}

/* Folds: a path's questions open under "Are you a…", and the college question closes
   for high schoolers. The row grows from 0 to its content's height while the
   questions fade up into place. */
.apply__fold {
  display: grid;
  grid-template-rows: 0fr;
  /* Cancel the column gap while folded, so a closed path takes no room */
  margin-top: -72px;
  transition: grid-template-rows .55s cubic-bezier(.2,.7,.2,1), margin-top .55s cubic-bezier(.2,.7,.2,1);
}
.apply__fold.is-open { grid-template-rows: 1fr; margin-top: 0; }
.apply__fold-inner {
  min-height: 0;
  overflow: hidden;
  /* Room for the sketched boxes' overshooting corners */
  margin: 0 -8px; padding: 0 8px;
  opacity: 0; transform: translateY(16px);
  transition: opacity .3s, transform .3s, visibility 0s .55s;
  visibility: hidden;
}
.apply__fold.is-open .apply__fold-inner {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity .45s .12s, transform .55s .12s cubic-bezier(.2,.7,.2,1), visibility 0s;
}

.apply__field {
  outline: none;
  margin: 0; padding: 0; border: 0;
  min-width: 0;
  /* Room for the sticky header when scrolled to an error */
  scroll-margin-top: calc(var(--header-h) + 32px);
}

.apply__question {
  display: block;
  padding: 0;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.apply__optional {
  margin-left: 12px;
  color: var(--faint);
  font-size: 16px;
  letter-spacing: 0;
  vertical-align: .3em;
}

.apply__hint {
  margin: 12px 0 0;
  max-width: 600px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.apply__input {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 0 0 10px;
  border: 0;
  border-radius: 0;
  /* Hand-drawn underline, inked darker on focus */
  background: url(assets/underline.svg?v=2) no-repeat left bottom / 100% 10px;
  color: var(--fg);
  font: inherit;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.35;
  outline: none;
  cursor: url(cursors/cursor-text.svg) 10 10, text;
}
.apply__input::placeholder { color: var(--faint); }
.apply__input:focus { background-image: url(assets/underline-focus.svg?v=2); }
.apply__input[aria-invalid="true"] { background-image: url(assets/underline-error.svg?v=2); }
.apply__input--long { resize: none; overflow: hidden; }
.apply__input--narrow { max-width: 280px; }
.apply__input--small { margin-top: 0; font-size: 20px; }

.apply__options {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
}
.apply__options--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
}
.apply__options--grid .apply__option { min-width: 0; }

.apply__option {
  position: relative;
  display: flex; align-items: center;
  min-width: 300px; max-width: 100%;
  padding: 13px 18px;
  font-size: 19px;
  line-height: 1.2;
  transition: color .16s;
}
/* Hand-drawn box (see .sketch in styles.css): grey ink at rest, black on hover, filled when chosen.
   Flipped per box so the wobble doesn't repeat down the column. */
.apply__option .sketch-line { stroke: #8f8a80; transition: stroke .16s; }
.apply__option .sketch-fill { fill: rgb(243 238 228 / .6); opacity: 1; transition: fill .16s; }
.apply__option:nth-child(4n+2) .sketch { transform: scaleX(-1); }
.apply__option:nth-child(4n+3) .sketch { transform: scaleY(-1); }
.apply__option:nth-child(4n+4) .sketch { transform: scale(-1); }
.apply__option, .apply__option * { cursor: url(cursors/cursor-pointer.svg) 6 1, pointer; }
.apply__option:hover .sketch-line { stroke: var(--fg); }
.apply__option input { position: absolute; opacity: 0; pointer-events: none; }
.apply__option:has(input:focus-visible) { outline: 1px solid var(--fg); outline-offset: 3px; }
.apply__option:has(input:checked) { color: var(--bg); }
.apply__option:has(input:checked) .sketch-line { stroke: var(--fg); }
.apply__option:has(input:checked) .sketch-fill { fill: var(--fg); }
.apply__option-label { position: relative; flex: 1; }

/* The company/student choice: two big side-by-side boxes, easy to hit */
.apply__options--path {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}
.apply__options--path .apply__option {
  min-width: 0;
  padding: 22px 24px;
  font-size: 21px;
}

.apply__other { max-width: 320px; margin-top: 18px; }

/* Under Submit (or the path choice, before one is picked) */
.apply__help { margin: 40px 0 0; color: var(--muted); font-size: 17px; line-height: 1.5; }
.apply__help a { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.apply__help a:hover { text-decoration-thickness: 2px; }

/* Team size: − [number] +, the buttons in the same hand-drawn box as the options */
.apply__count { display: flex; align-items: center; gap: 18px; margin-top: 24px; }
.apply__input--count { width: 3ch; margin-top: 0; text-align: center; }
.apply__step {
  position: relative;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  transition: color .16s;
}
.apply__step span { position: relative; }
.apply__step .sketch-line { stroke: #8f8a80; transition: stroke .16s; }
.apply__step[data-step="1"] .sketch { transform: scaleX(-1); }
.apply__step:hover:not(:disabled) { color: var(--bg); }
.apply__step:hover:not(:disabled) .sketch-line { stroke: var(--fg); }
.apply__step:hover:not(:disabled) .sketch-fill { opacity: 1; }
.apply__step:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.apply__step:disabled { color: var(--faint); cursor: default; }
.apply__step:disabled .sketch-line { stroke: var(--stroke); }

/* Team LinkedIns: one line per teammate */
.apply__rows { display: flex; flex-direction: column; gap: 18px; margin-top: 24px; }
.apply__rows .apply__input { margin-top: 0; }

/* A hairline closes the form above Submit */
.apply__actions {
  margin-top: 88px;
  padding-top: 48px;
  border-top: 1px solid var(--stroke);
  animation: apply-reveal .45s .12s both;
}
/* Submit waits until a path is chosen (apply.js) */
.apply__actions[hidden] { display: none; }
@keyframes apply-reveal { from { opacity: 0; } }

/* Hand-drawn box (see .sketch in styles.css); fills with ink on hover */
.apply__button {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 12px 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 19px;
  line-height: 1;
  transition: color .2s;
}
.apply__button span { position: relative; }
.apply__button:hover { color: var(--bg); }
.apply__button:hover .sketch-fill { opacity: 1; }
.apply__button:disabled { color: var(--faint); }
.apply__button:disabled .sketch-fill { opacity: 0; }
.apply__button:disabled .sketch-line { stroke: var(--faint); }
.apply__button:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

.apply__error {
  margin: 16px 0 0;
  color: var(--error);
  font-size: 17px;
}
.apply__error:empty { display: none; }

.apply__trap {
  position: absolute; left: -10000px;
  width: 1px; height: 1px; overflow: hidden;
}

/* After sending: the message sits centred in the frame and fades up */
.apply.is-done {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100dvh - var(--header-h) - var(--footer-h));
  padding-top: 40px; padding-bottom: 40px;
}
.apply__done {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  outline: none;
  animation: apply-done .8s cubic-bezier(.2,.7,.2,1) both;
}
.apply__done .apply__hint { margin-top: 14px; }
.apply__done .apply__button { margin-top: 40px; text-decoration: none; }
@keyframes apply-done { from { opacity: 0; transform: translateY(16px); } }

@media (max-width: 639px) {
  .members { padding: 48px 20px; }
  .members__cards { grid-template-columns: 1fr; gap: 16px; margin-top: 36px; }
  .members__card { min-height: 0; padding: 26px 24px 22px; }
  .apply { padding: 56px 20px 96px; }
  .apply__fields, .apply__fold-inner { gap: 56px; }
  .apply__fold { margin-top: -56px; }
  .apply__actions { margin-top: 64px; padding-top: 40px; }
  .apply__hint { font-size: 16px; }
  .apply__input { margin-top: 20px; }
  .apply__options { gap: 8px; }
  .apply__options--grid, .apply__options--path { grid-template-columns: 1fr; }
  .apply__options--path .apply__option { padding: 16px 18px; font-size: 19px; }
  .apply__option { width: 100%; min-width: 0; padding: 11px 14px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .apply__fold, .apply__fold-inner, .apply__fold.is-open .apply__fold-inner { transition: none; }
  .apply__actions, .apply__done, .notice { animation: none; }
}
