:root {
  color-scheme: light dark;
  --paper: #fbf4ea;
  --ink: #241d19;
  --soft: #6b5f56;
  --line: #e6d8c7;
  --card: #fffdf9;
  --field: #fffdf9;
  --accent: #c2502c;
  --accent-deep: #a23d1d;
  --on-accent: #fff8f1;
  --tint: #f9e3d3;
  --mark: #ffd9a8;
  --glow-a: #ffd9bd;
  --glow-b: #dfe8cf;
  --shadow: 0 1px 2px rgb(74 45 24 / .06), 0 12px 32px -12px rgb(74 45 24 / .22);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191512;
    --ink: #f1e9df;
    --soft: #b0a396;
    --line: #3a322b;
    --card: #221d19;
    --field: #2a2420;
    --accent: #f08a62;
    --accent-deep: #e2764c;
    --on-accent: #1d120c;
    --tint: #33231a;
    --mark: #6b3a1c;
    --glow-a: #3a2216;
    --glow-b: #1f2a1e;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -12px rgb(0 0 0 / .6);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(60rem 34rem at -10% -8%, var(--glow-a), transparent 62%),
    radial-gradient(48rem 30rem at 108% 4%, var(--glow-b), transparent 60%),
    var(--paper);
  background-repeat: no-repeat;
  color: var(--ink); font: 1.0625rem/1.65 var(--sans); margin: 0; min-height: 100vh;
}
main { margin: 0 auto; max-width: 42rem; padding: 1.25rem 1.25rem 5rem; }

/* who is writing: photos first, then his own words */
#profile { font-size: 1.125rem; }
#profile h1 {
  font-size: clamp(2.5rem, 9vw, 3.6rem); font-weight: 800; letter-spacing: -.035em;
  line-height: 1.05; margin: 2.2rem 0 1.2rem;
}
#profile h1::after {
  background: linear-gradient(90deg, var(--accent), var(--mark)); border-radius: 999px;
  content: ""; display: block; height: .4rem; margin-top: 1.1rem; width: 4.5rem;
}
#profile p { margin: 0 0 1.1rem; }
/* who sent her here and why the page exists: a soft strip above everything else */
#profile .referral {
  background: var(--tint); border-radius: 18px; font-size: 1rem; line-height: 1.45;
  margin: 0 0 1.2rem; padding: .9rem 1.1rem;
}
#profile .referral span { font-weight: 700; }
#profile h1 + p { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.45; }
#profile section {
  background: var(--tint); border-radius: 22px; margin: 2rem 0 0; padding: 1.5rem 1.6rem 1.6rem;
}
#profile section h2 {
  color: var(--accent-deep); font-size: .85rem; font-weight: 700; letter-spacing: .12em;
  margin: 0 0 .6rem; text-transform: uppercase;
}
#profile section p { font-size: 1.2rem; font-weight: 500; line-height: 1.55; }
#profile section p:last-child { margin-bottom: 0; }

/* where else to find him: quiet, after his own words */
.links { margin: 2rem 0 0; }
.links p { color: var(--soft); font-size: 1.0625rem; margin: 0 0 .7rem; }
.links nav { display: flex; flex-wrap: wrap; gap: .6rem; }
.links a {
  align-items: center; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; color: var(--ink); display: inline-flex; font-size: 1rem; font-weight: 600;
  gap: .55rem; padding: .5rem 1.05rem; text-decoration: none;
  transition: border-color .15s, color .15s;
}
.links a:hover { border-color: var(--accent); color: var(--accent-deep); }
.links a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.links svg { fill: currentColor; flex: none; height: 1.05rem; width: 1.05rem; }

/* the first photo is the large one; a tile opens the whole photo */
.photos { display: grid; gap: .6rem; grid-template-columns: repeat(3, 1fr); }
.photos a { border-radius: 18px; box-shadow: var(--shadow); display: block; overflow: hidden; }
.photos img {
  aspect-ratio: 4 / 5; display: block; object-fit: cover; object-position: 50% 30%;
  transition: transform .35s ease; width: 100%;
}
.photos a:hover img { transform: scale(1.04); }
.photos a:first-child:not(:only-child) { grid-column: span 2; grid-row: span 2; }
.photos a:first-child:not(:only-child) img { aspect-ratio: auto; height: 100%; }
/* a scene too wide for a tile gets a row to itself: three tiles across, one high */
.photos a.wide { grid-column: 1 / -1; }
.photos a.wide img { aspect-ratio: 12 / 5; object-position: 50% 50%; }
.photos a:only-child { grid-column: 1 / -1; }
.photos a:only-child img { aspect-ratio: auto; }
.photos a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* the form is a card of its own */
#hello {
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow); margin-top: 2.5rem; padding: 2rem 1.5rem 2.2rem;
}
#hello h2 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 .4rem; }
#hello h3 {
  border-top: 1px solid var(--line); font-size: 1.3rem; font-weight: 750; letter-spacing: -.015em;
  line-height: 1.3; margin: 2.4rem 0 .2rem; padding-top: 1.8rem;
}
.lead, .hint, .note { color: var(--soft); margin: 0 0 1rem; }
.lead { font-size: 1.125rem; }
.hint, .note { font-size: .95rem; }
.note {
  background: var(--tint); border-radius: 14px; color: var(--ink); margin: 2.2rem 0 1.4rem;
  padding: .9rem 1.1rem;
}

.field { color: var(--soft); display: block; font-size: .95rem; font-weight: 600; margin: 1.1rem 0; }
.field input, .field textarea {
  background: var(--field); border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink);
  display: block; font: 400 1.0625rem/1.5 var(--sans); margin-top: .35rem; padding: .75rem .9rem;
  width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--tint); outline: 0;
}
::placeholder { color: var(--soft); opacity: .65; }
.pair { display: grid; gap: 0 1rem; grid-template-columns: 1fr 7rem; }

fieldset { border: 0; margin: 1.6rem 0; min-width: 0; padding: 0; }
legend { font-weight: 700; margin-bottom: .6rem; padding: 0; }
fieldset .hint { margin-bottom: .7rem; }

/* fixed choices are pills; the real input stays in the page for the keyboard and for validation */
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choices .field { flex-basis: 100%; margin: .4rem 0 0; }
.choice, .add-photo { cursor: pointer; position: relative; }
.choice input, .add-photo input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.choice span, .add-photo span {
  background: var(--field); border: 1.5px solid var(--line); border-radius: 999px;
  display: inline-block; font-weight: 500; padding: .5rem 1.1rem;
  transition: background .15s, border-color .15s, color .15s;
}
.choice:hover span, .add-photo:hover span { border-color: var(--accent); }
.choice input:checked + span {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 650;
}
.choice input:focus-visible + span, .add-photo input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.add-photo { display: inline-block; margin: .2rem 0 .3rem; }
.add-photo span { border-style: dashed; color: var(--accent-deep); font-weight: 650; }
.add-photo span::before { content: "+ "; }
.add-photo input:disabled + span { cursor: default; opacity: .45; }

#photo-list { display: flex; flex-wrap: wrap; gap: .75rem; }
#photo-list:not(:empty) { margin-bottom: .9rem; }
.photo-item { text-align: center; }
.photo-item img { border-radius: 14px; display: block; height: 7rem; object-fit: cover; width: 7rem; }
.photo-item button {
  background: none; border: 0; color: var(--soft); cursor: pointer; font: .85rem var(--sans);
  margin-top: .2rem; padding: .2rem .4rem; text-decoration: underline;
}

button[type="submit"] {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep)); border: 0;
  border-radius: 999px; box-shadow: 0 10px 22px -10px var(--accent-deep); color: var(--on-accent);
  cursor: pointer; font: 700 1.15rem var(--sans); padding: 1rem 2.4rem;
  transition: transform .15s, box-shadow .15s; width: 100%;
}
button[type="submit"]:hover { box-shadow: 0 14px 26px -10px var(--accent-deep); transform: translateY(-1px); }
button[type="submit"]:disabled { cursor: default; opacity: .6; transform: none; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#status { color: var(--soft); margin: 1rem 0 0; min-height: 1.6rem; text-align: center; }
[hidden] { display: none !important; }
#done {
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow); font-size: 1.2rem; margin-top: 14vh; outline: 0;
  padding: 3rem 1.5rem; text-align: center;
}
#done::before {
  background: var(--accent); border-radius: 50%; color: var(--on-accent); content: "\2713";
  display: block; font-size: 1.8rem; font-weight: 700; height: 3.6rem; line-height: 3.6rem;
  margin: 0 auto 1.4rem; width: 3.6rem;
}
#done h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin: 0 0 .6rem; }
#done p { color: var(--soft); margin: 0; }

/* room to spare: photos stay beside the words, and the form sits under both */
@media (min-width: 62rem) {
  main { max-width: 70rem; padding: 3rem 2rem 6rem; }
  #profile:has(.photos) { column-gap: 3.5rem; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  #profile:has(.photos) > * { grid-column: 2; }
  #profile:has(.photos) > .photos { align-self: start; grid-column: 1; grid-row: 1 / span 40; position: sticky; top: 2rem; }
  #profile:has(.photos) h1 { margin-top: .4rem; }
  #profile:has(.photos) > .referral {
    border-radius: 26px; grid-column: 1 / -1; grid-row: 1; margin: 0 0 2rem; padding: .7rem 1.6rem;
    text-align: center;
  }
  /* the strip takes the first row only while it is shown */
  #profile:has(.referral:not([hidden])) > .photos { grid-row: 2 / span 40; }
  #hello, #done { margin-left: auto; margin-right: auto; max-width: 44rem; padding: 2.8rem 3rem 3rem; }
  #hello { margin-top: 4.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
