/* Candy Cane Grams. The Higginbotham app family (navy top bar with the white logo, Hanken Grotesk, a soft canvas,
   white cards) around one object: the gram card, in the design Sarah chose (red and white stripe, navy, Fraunces). */
@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/HankenGrotesk-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/HankenGrotesk-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/HankenGrotesk-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/HankenGrotesk-800.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-latin.woff2') format('woff2'); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-italic-latin.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --navy: #0a3255; --navy-2: #14325c; --red: #c8102e; --red-dark: #a50d26; --blue: #1f5fbf;
  --canvas: #f4f6fa; --card: #fff; --line: #e3e8f0; --line-2: #cfd7e3;
  --ink: #15233b; --ink-2: #3d4b63; --muted: #607089;
  --amber: #a15c00; --amber-bg: #fff4e0; --green: #1d7a46; --green-bg: #e7f5ec;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 33, 60, .06), 0 6px 18px rgba(16, 33, 60, .07);
  --font: 'Hanken Grotesk', system-ui, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--canvas); }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: #f6cdd5; color: var(--ink); }
input, textarea { caret-color: var(--red); }
* { scrollbar-color: #c3cddb transparent; scrollbar-width: thin; }
.num, td.n, .tab-num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #7aa7ea; outline-offset: 2px; }
main[tabindex="-1"]:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar { background: linear-gradient(90deg, #0a3255, #12406b); color: #fff; }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; flex: none; min-width: 0; }
.brand img { height: 22px; width: auto; display: block; flex: none; }
.brand .mark { display: none; height: 28px; }
.brand .sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .35); flex: none; }
.brand .name { font-weight: 700; font-size: 17px; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: 12px; min-width: 0; }
.nav a { color: #dce7f5; text-decoration: none; padding: 0 12px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 8px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; }
.nav .count { font-weight: 400; opacity: .8; margin-left: .3em; font-variant-numeric: tabular-nums; }
.who { margin-left: auto; position: relative; flex: none; }
.who > button { background: none; border: 0; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 8px; min-height: 40px; border-radius: 8px; cursor: pointer; max-width: 240px; }
.who > button:hover { background: rgba(255, 255, 255, .1); }
.who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.who .ini { display: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .18); align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px rgba(10, 30, 60, .18); min-width: 230px; padding: 8px; z-index: 20; }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.menu .menu-head b { display: block; color: var(--ink); font-size: 15px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 10px 10px; min-height: 42px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.menu a:hover, .menu button:hover { background: var(--canvas); }
.ribbon { height: 7px; background: repeating-linear-gradient(135deg, var(--red) 0 10px, #fff 10px 20px); }

/* ---------- page ---------- */
main.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 4px; }
.lede { color: var(--ink-2); margin: 0 0 22px; font-size: 17px; }
.page-head { display: flex; gap: 14px 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .lede { margin-bottom: 0; }
.page-head .sub-note { margin: 6px 0 0; }
.page-head .head-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel > p:first-child { margin-top: 0; }
.panel > p:last-child { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b4c0d2; background: #fafbfd; }
.btn.primary { background: linear-gradient(180deg, #d4183a, var(--red)); border-color: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(200, 16, 46, .28); }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { background: #194f9f; }
.btn.big { min-height: 52px; font-size: 17px; padding: 12px 24px; }
.btn.link { border: 0; background: none; color: var(--blue); padding: 6px 6px; min-height: 36px; font-weight: 600; white-space: normal; text-align: left; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.danger { color: #b3261e; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.alerts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.note { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; background: #eef3fb; color: #22406b; }
.note + .note { margin-top: 10px; }
.alerts .note + .note { margin-top: 0; }
.note.mb { margin-bottom: 14px; }
.note > svg, .note-body > svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.note-body { display: flex; gap: 10px; align-items: flex-start; flex: 1 1 240px; min-width: 0; }
.note.warn { background: var(--amber-bg); color: #6b3d00; }
.note.ok { background: var(--green-bg); color: #155c35; }
.note.err { background: #fdecea; color: #8c1d18; }

label.lab { display: block; font-weight: 700; margin: 0 0 6px; }
label.lab.note-lab { margin-top: 16px; }
input.text, textarea.text, select.text { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px; background: #fff; min-height: 46px; }
textarea.text { min-height: 120px; resize: vertical; line-height: 1.5; }
input.text:focus, textarea.text:focus, select.text:focus { border-color: var(--blue); outline: 3px solid rgba(31, 95, 191, .18); }

/* ---------- the gram card (Sarah's first design; the stripe can no longer collapse) ---------- */
.gram { background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 33, 60, .08), 0 10px 28px rgba(16, 33, 60, .10); overflow: hidden; display: flex; flex-direction: column;
  font-family: var(--font); color: var(--navy-2); position: relative; min-height: 360px; }
.gram .stripe { flex: 0 0 22px; height: 22px; background: repeating-linear-gradient(135deg, var(--red) 0 11px, #fff 11px 22px); border-bottom: 3px solid var(--navy-2); }
.gram .gram-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gram .hole { width: 16px; height: 16px; border-radius: 50%; border: 1.5px dashed var(--navy-2); opacity: .7; flex: none; }
.gram .body { padding: 18px 24px 18px; display: flex; flex-direction: column; flex: 1; gap: 4px; }
.gram .logo { height: 17px; width: auto; display: block; }
.gram .title { font-family: var(--serif); font-weight: 700; font-size: 31px; line-height: 1.05; margin: 10px 0 0; color: var(--navy-2); }
.gram .sub { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--red); }
.gram .to { margin-top: 12px; font-size: 14px; }
.gram .to b { font-weight: 700; }
.gram .to .placeholder { color: #96a2b5; font-style: italic; }
.gram .words { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: #1f2a3d; margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.gram .words p { margin: 0 0 8px; }
.gram .words p:last-child { margin-bottom: 0; }
.gram .words .placeholder { color: #96a2b5; font-style: italic; }
.gram .grow { flex: 1; min-height: 12px; }
.gram .from { border-top: 2px solid var(--navy-2); padding-top: 10px; text-align: center; }
.gram .from small { display: block; font-size: 12px; color: #4a5568; }
.gram .from strong { display: block; font-family: var(--serif); font-size: 16px; line-height: 1.25; text-wrap: balance; }
.gram .from strong.placeholder { color: #96a2b5; font-style: italic; font-weight: 400; font-size: 15px; }
.gram.mini { min-height: 0; }
.gram.mini .title { font-size: 22px; }
.gram.mini .words { font-size: 15px; }

/* ---------- the composer ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.compose > * { min-width: 0; }
.compose .preview { position: sticky; top: 20px; }
.preview-head { display: none; font-size: 18px; margin: 0 0 12px; color: var(--ink); }
.step { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.step + .step { margin-top: 16px; }
.step h2 { font-size: 19px; margin-bottom: 14px; }
.step-note { margin: 12px 0 0; }
.search { position: relative; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(10, 30, 60, .16); z-index: 10; max-height: 340px; overflow: auto; padding: 6px; }
.results-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.person { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 10px; min-height: 48px; cursor: pointer; }
.person:hover, .person[aria-selected="true"] { background: #eef3fb; }
.person .pn { font-weight: 700; display: block; }
.person .pd { color: var(--muted); font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .av { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #e6edf7; color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.person > span:nth-child(2) { flex: 1; min-width: 0; }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; margin-top: 14px; }
.suggest-head { grid-column: 1 / -1; margin-bottom: 2px; }
.chosen { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafd; }
.chosen .person { padding: 0; min-height: 0; width: auto; cursor: default; flex: 1 1 0; min-width: 0; }
.chosen .person .pd { white-space: normal; }
.chosen .person:hover { background: none; }
.chosen .btn.link { flex: none; }
.choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; }
.choice:hover { border-color: #b9c6da; }
.choice input { margin-top: 4px; accent-color: var(--red); width: 18px; height: 18px; flex: none; }
.choice:has(input:checked) { border-color: var(--red); background: #fff7f8; }
.choice .ct { display: block; }
.choice .cs { display: block; color: var(--muted); font-size: 14px; }
.choice .serif { font-family: var(--serif); font-size: 16px; line-height: 1.45; }
.counter { text-align: right; font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.counter.over { color: #b3261e; font-weight: 700; }
.sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.arrives { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink-2); margin: 14px 0 12px; }
.arrives svg { flex: none; width: 20px; height: 20px; color: var(--red); margin-top: 2px; }
.sendrow { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.sendrow .btn.primary { width: 100%; }
.sendrow .btn.link { align-self: center; }
.err-line { color: #b3261e; font-weight: 600; margin: 0 0 12px; font-size: 15px; }
.err-line:empty { margin: 0; }

/* ---------- lists of grams ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 22px; }
.mine-foot { margin-top: 24px; }
.sentlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sentitem { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
.sentitem .who2 { font-weight: 700; font-size: 17px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.sentitem .secret-tag { color: var(--muted); font-size: 14px; font-weight: 400; white-space: nowrap; }
.sentitem .st { font-size: 14px; color: var(--muted); margin-top: 2px; }
.sentitem .st.held { color: var(--amber); }
.sentitem .txt { grid-column: 1 / -1; font-family: var(--serif); font-size: 16px; line-height: 1.5; color: #1f2a3d; white-space: pre-wrap; overflow-wrap: anywhere; }
.sentitem .txt p { margin: 0 0 6px; }
.sentitem .txt p:last-child { margin-bottom: 0; }
.sentitem .txt .say { color: var(--ink-2); }
.sentitem .acts { display: flex; gap: 10px; align-items: flex-start; flex: none; }

/* ---------- the front page for people not signed in ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; padding: 18px 0 30px; }
.hero h1 { font-size: 42px; }
.hero .gram { transform: rotate(1.8deg); max-width: 380px; justify-self: center; width: 100%; }
.how { display: grid; gap: 14px; margin: 22px 0; padding: 0; list-style: none; }
.how li { display: flex; gap: 14px; align-items: flex-start; }
.how .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.ask-intro { margin: 6px 0 0; }
.ask-sep { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.ask-sep .small { margin: 0; }
.ask { display: flex; gap: 8px; margin-top: 8px; max-width: 480px; }
.ask input { flex: 1; min-width: 0; }
.ask .btn { flex: none; }
.ask-msg { margin: 10px 0 0; }
.ask-msg:empty { margin: 0; }

/* ---------- empty and done states ---------- */
.empty { text-align: center; padding: 50px 20px; }
.empty h2 { font-size: 22px; }
.empty-card { max-width: 520px; margin: 24px auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 28px; text-align: center; }
.empty-icon { width: 48px; height: 48px; border-radius: 50%; background: #eef3fb; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.empty-card h2 { font-size: 22px; margin: 0 0 8px; }
.empty-card p { margin: 0 0 18px; }
.empty-card p:last-child { margin-bottom: 0; }
.done { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 32px; align-items: center; padding-top: 8px; }
.done .check { width: 48px; height: 48px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.done .row .btn { min-height: 50px; }

.plain { display: grid; place-items: center; min-height: 100vh; }
.plain-box { max-width: 460px; padding: 24px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #15233b; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 50; font-weight: 600; max-width: calc(100% - 32px); }

@media (max-width: 900px) {
  .compose { grid-template-columns: minmax(0, 1fr); }
  .compose .preview { position: static; order: 2; }
  .preview-head { display: block; }
  .hero, .done { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hero .gram { transform: none; max-width: 360px; margin: 0 auto; }
  .done .done-copy { order: -1; }
  .done .gram { max-width: 360px; margin: 0 auto; width: 100%; }
}
@media (max-width: 640px) {
  main.page { padding: 18px 14px 60px; }
  h1, .hero h1 { font-size: 27px; }
  .bar-in { padding: 0 12px; gap: 8px; height: 56px; }
  .brand .word { display: none; }
  .bar-in:has(.nav) .brand .name, .bar-in:has(.nav) .brand .sep { display: none; }
  .brand .mark { display: block; }
  .nav { margin-left: 4px; gap: 2px; }
  .nav a { padding: 0 9px; min-height: 44px; font-size: 14px; }
  .nav .count { display: none; }
  .who > button { min-width: 44px; min-height: 44px; padding: 6px; }
  .who .nm { display: none; }
  .who .ini { display: flex; }
  .btn.link { min-height: 44px; padding: 8px 6px; }
  .page-head { margin-bottom: 16px; }
  .page-head .head-acts { margin-left: 0; width: 100%; }
  .page-head .head-acts .btn { width: 100%; }
  .suggest { grid-template-columns: minmax(0, 1fr); }
  .sign { grid-template-columns: minmax(0, 1fr); }
  .step { padding: 16px; }
  .ask { flex-direction: column; }
  .ask .btn { width: 100%; }
  .done .row { flex-direction: column; align-items: stretch; }
  .done .row .btn { width: 100%; }
  .sentitem { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 16px; }
  .sentitem .acts { order: 3; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; gap: 16px; }
  .sentitem .acts .btn.link:first-child { margin-left: -6px; }
  .empty-card { margin: 12px auto; padding: 28px 20px; }
}
@media (max-width: 380px) { .nav a { padding: 0 6px; } }
@media (prefers-reduced-motion: no-preference) {
  .gram.pop { animation: pop .32s cubic-bezier(.16, 1, .3, 1) both; }
  @keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
}
