/* ── Fonts (self-hosted, OFL; see static/fonts/OFL-*.txt) ──── */
@font-face {
  font-family: 'Archivo Black';
  src: url('../fonts/ArchivoBlack-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter Tight';
  src: url('../fonts/InterTight.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy:     #1e3264;
  --navy-hi:  #2c4889;
  --navy-lo:  #15264f;
  --lime:     #f4ff5c;
  --bg:       var(--navy);
  --card:     rgba(255,255,255,.08);
  --border:   rgba(255,255,255,.14);
  --accent:   var(--lime);
  --accent2:  #8fb3ff;
  --text:     #ffffff;
  --muted:    rgba(255,255,255,.68);
  --radius:   16px;
  --font:     'Inter Tight', system-ui, -apple-system, sans-serif;
  --display:  'Archivo Black', 'Inter Tight', system-ui, sans-serif;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
button { font: inherit; }

.display { font-family: var(--display); letter-spacing: -0.04em; line-height: .88; }

/* ── Nav ───────────────────────────────────────────────────── */
.top-nav { padding: 1rem 1.25rem; }
.nav-logo { font-family: var(--display); font-size: 1.05rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }

/* ── Flash messages ────────────────────────────────────────── */
.flash-container { padding: 0 1.25rem; max-width: 560px; margin: 0 auto; }
.flash { padding: .8rem 1rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem; margin-top: .75rem; }
.flash--error   { background: rgba(255,70,50,.22); border: 1px solid rgba(255,120,100,.6); }
.flash--success { background: rgba(25,230,140,.18); border: 1px solid rgba(25,230,140,.5); }

/* ── Card ──────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .pill {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--font); font-weight: 800; font-size: 1.05rem;
  padding: .9rem 1.6rem; border-radius: 999px; border: 0; cursor: pointer;
  text-decoration: none; transition: transform .15s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--accent); color: var(--navy-lo); }
.btn-secondary { background: rgba(255,255,255,.12); color: var(--text); }
.pill-light { background: #fff; color: #111; }
.btn-primary:active, .btn-secondary:active, .pill:active { transform: scale(.97); }

/* ── Blobs (tonal circles behind content) ──────────────────── */
.blob { position: absolute; border-radius: 50%; pointer-events: none; }

/* ── Landing ───────────────────────────────────────────────── */
/* Sized to the visible viewport (dvh) so the whole flow fits on one screen. */
.landing { position: relative; overflow: hidden; min-height: 100dvh; display: flex; align-items: center; }
.landing .blob.b1 { width: 380px; height: 380px; top: -200px; right: -190px; background: var(--navy-hi); }
.landing .blob.b2 { width: 260px; height: 260px; bottom: -110px; left: -120px; background: var(--navy-lo); }
.landing-inner { position: relative; width: 100%; max-width: 540px; margin: 0 auto; padding: clamp(.75rem, 3.5dvh, 3.5rem) 1.6rem clamp(.75rem, 2.5dvh, 3rem); }
.eyebrow { font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.landing h1 { font-size: clamp(2.6rem, min(16vw, 9dvh), 5.6rem); margin-top: clamp(.4rem, 1.5dvh, 1rem); }
.landing .lede { margin-top: clamp(.4rem, 1.5dvh, 1rem); }
.steps { list-style: none; margin-top: clamp(1rem, 4dvh, 2.6rem); display: flex; flex-direction: column; gap: clamp(.85rem, 3dvh, 1.9rem); }
.steps .eyebrow { margin-bottom: clamp(.35rem, 1dvh, .6rem); }
.chip { display: flex; align-items: center; gap: .6rem; background: var(--card); border-radius: 14px; padding: .55rem .55rem .55rem 1rem; }
.chip code { flex: 1; font-family: var(--font); font-weight: 700; font-size: 1rem; word-break: break-all; }
.chip button { flex: none; background: var(--accent); color: var(--navy-lo); font-weight: 800; border: 0; border-radius: 10px; padding: .55rem .9rem; cursor: pointer; }
.landing .cta { font-size: 1.25rem; padding: 1.1rem 2.2rem; }
.fine-print { margin-top: clamp(.6rem, 2.2dvh, 2rem); color: var(--muted); font-size: .8rem; font-weight: 600; }
.fine-print a { color: inherit; }
.returning { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(.8rem, 2.4dvh, 1.2rem); margin-top: clamp(1rem, 4dvh, 2.6rem); }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); font: 700 .95rem var(--font); text-decoration: underline; cursor: pointer; }
/* Short screens (phones with browser toolbars, small laptops): tighter type, two-line title. */
@media (max-height: 760px) {
  .tall-only { display: none; }
  .landing .lede { font-size: .95rem; line-height: 1.35; }
  .steps .eyebrow { font-size: 1rem; }
  .landing .pill { padding: .65rem 1.3rem; }
  .landing .cta { padding: .85rem 1.9rem; }
}
/* Very short screens (older 4-inch phones): a little less air so nothing scrolls. */
@media (max-height: 600px) {
  .steps { gap: .7rem; margin-top: .8rem; }
  .landing .lede { margin-top: .3rem; }
}

/* ── Waiting ───────────────────────────────────────────────── */
.waiting-page { --bg: #f037a5; background: var(--bg); position: relative; overflow: hidden; min-height: 100dvh; display: flex; align-items: center; }
.waiting-page .blob.b1 { width: 360px; height: 360px; bottom: -150px; left: -140px; background: #cf2689; }
.waiting-page .blob.b2 { width: 220px; height: 220px; top: -70px; right: -70px; background: #f564bb; }
.waiting-inner { position: relative; width: 100%; max-width: 540px; margin: 0 auto; padding: 3rem 1.6rem; }
.waiting-inner h1 { font-size: clamp(3.6rem, 16vw, 4.9rem); }
.waiting-status { font-size: 1.3rem; font-weight: 800; margin-top: 1.4rem; min-height: 2em; }
.progress-track { height: 8px; background: rgba(0,0,0,.18); border-radius: 99px; overflow: hidden; margin-top: 1rem; }
.progress-fill { height: 100%; background: #ffe14d; border-radius: 99px; transition: width .6s ease; }
.waiting-step { font-weight: 700; opacity: .8; margin-top: .5rem; font-size: .95rem; }
.waiting-hint { margin-top: 2rem; display: flex; flex-direction: column; gap: .7rem; }
.waiting-hint p { font-weight: 700; }
.waiting-hint .chip { background: rgba(0,0,0,.18); }
.waiting-hint .chip button { background: #ffe14d; }
.error-box { margin-top: 2rem; background: rgba(0,0,0,.22); border-radius: var(--radius); padding: 1.3rem; }
.error-box strong { display: block; font-size: 1.2rem; margin-bottom: .4rem; }
.error-box p { margin-bottom: 1rem; }
.error-box .btn-primary { background: #ffe14d; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .9s linear infinite; margin-bottom: 1.6rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Friend comparison ─────────────────────────────────────── */
body:has(.compare-page) .flash-container {
  position: absolute; z-index: 10; top: .9rem; left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 2rem), 560px); margin: 0; padding: 0;
}
body:has(.compare-page) .flash { margin: 0; box-shadow: 0 8px 28px rgba(0,0,0,.2); }
body:has(.compare-page):has(.flash) .compare-shell { padding-top: 6.5rem; }
.compare-page {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #6c2bd9;
}
.compare-page .blob.b1 { width: 430px; height: 430px; top: -220px; right: -180px; background: #8550ec; }
.compare-page .blob.b2 { width: 330px; height: 330px; bottom: -150px; left: -150px; background: #5420b4; }
.compare-shell { position: relative; width: min(100%, 620px); margin: 0 auto; padding: 2.5rem 1.35rem 4rem; }
.compare-shell.wide { width: min(100%, 920px); }
.back-link { display: inline-block; color: rgba(255,255,255,.78); font-weight: 700; text-decoration: none; margin-bottom: 2.4rem; }
.compare-page h1 { font-size: clamp(3.7rem, 16vw, 6.4rem); margin: 1rem 0 1.5rem; overflow-wrap: anywhere; color: var(--lime); }
.compare-lead { max-width: 540px; font-size: 1.2rem; font-weight: 700; color: rgba(255,255,255,.78); }
.compare-form { display: grid; gap: .9rem; margin-top: 2rem; }
.compare-form label { font-weight: 800; }
.compare-form input {
  width: 100%; border: 1px solid rgba(255,255,255,.24); border-radius: 12px;
  padding: 1rem; background: rgba(0,0,0,.18); color: #fff; font: inherit;
}
.compare-form input::placeholder { color: rgba(255,255,255,.48); }
.compare-form input:focus { outline: 3px solid var(--lime); outline-offset: 2px; }
.invite-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; }
.invite-card h2 { font-family: var(--display); font-size: 1.8rem; line-height: 1; margin: .25rem 0; }
.card-label { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .72; }

.compare-result { background: #f037a5; }
.compare-result .blob.b1 { background: #f564bb; }
.compare-result .blob.b2 { background: #cf2689; }
.compare-result h1 { max-width: 760px; }
.match-score { display: flex; align-items: baseline; gap: .8rem; margin: 1rem 0 2rem; }
.match-score strong { font-family: var(--display); font-size: clamp(4rem, 14vw, 7rem); line-height: .8; color: #ffe14d; }
.match-score span { font-size: 1.3rem; font-weight: 800; }
/* Both cards share the parent's rows (subgrid), so a two-line top item on one side
   lines up the stats, badge and link with the other card instead of pushing them down. */
.profiles { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); column-gap: 1rem; }
.friend-profile { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; min-width: 0; padding: 1.5rem; border-radius: 20px; background: #2d46b9; overflow: hidden; }
.friend-profile.right { background: #ff7a1a; }
.friend-profile > .card-label { grid-row: 1; }
.friend-profile h2 { grid-row: 2; font-size: clamp(1.65rem, 5vw, 2.5rem); color: #f4ff5c; margin: .65rem 0 1.25rem; overflow-wrap: anywhere; }
.friend-profile dl { grid-row: 3; display: grid; gap: .8rem; }
.friend-profile dl div { display: flex; justify-content: space-between; gap: .75rem; border-top: 1px solid rgba(255,255,255,.18); padding-top: .7rem; }
.friend-profile dt { color: rgba(255,255,255,.72); font-weight: 700; }
.friend-profile dd { font-weight: 900; text-align: right; }
.profile-badge { grid-row: 4; justify-self: start; align-self: start; display: inline-block; margin-top: 1.2rem; border-radius: 999px; padding: .45rem .7rem; background: rgba(0,0,0,.16); font-weight: 800; }
.friend-profile a { grid-row: 5; justify-self: start; display: block; color: #fff; font-weight: 800; margin-top: 1rem; }
.caf-buddy { margin-top: 1rem; background: #19e68c; color: #0d1f12; }
.caf-buddy > strong { display: block; font-family: var(--display); font-size: clamp(4rem, 14vw, 7rem); line-height: .85; margin-top: .8rem; }
.caf-buddy > p:not(.card-label) { font-size: 1.25rem; font-weight: 800; }
.caf-buddy ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.caf-buddy li { border-radius: 999px; padding: .4rem .65rem; background: rgba(0,0,0,.09); font-weight: 800; }
.caf-buddy small { display: block; margin-top: 1rem; font-weight: 700; opacity: .68; }
.shared-card { margin-top: 1rem; }
.shared-card ol, .ranked-card ol { list-style: none; display: grid; gap: .7rem; margin-top: .8rem; }
.shared-card li, .ranked-card li { display: flex; align-items: center; gap: .65rem; font-family: var(--display); font-size: clamp(1.25rem, 4vw, 2rem); line-height: 1.05; }
.shared-card li span, .ranked-card li span { flex: none; display: inline-flex; width: 1.8rem; height: 1.8rem; align-items: center; justify-content: center; border-radius: 50%; background: #ffe14d; color: #2a0f00; font: 800 .85rem var(--font); }
.compare-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.2rem; }

/* ── Campus Wrapped ────────────────────────────────────────── */
.campus-page { background: #2d46b9; }
.campus-page .blob.b1 { background: #4762d6; }
.campus-page .blob.b2 { background: #22389a; }
.campus-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 1.6rem 0 1rem; }
.campus-stats strong { display: block; font-family: var(--display); font-size: clamp(2rem, 6vw, 2.8rem); line-height: 1; color: var(--lime); margin: .5rem 0 .3rem; }
.campus-stats p:last-child { font-weight: 700; color: rgba(255,255,255,.72); }
.ranked-card, .busiest-card { margin-top: 1rem; }
.ranked-card li small { margin-left: auto; font: 700 .95rem var(--font); opacity: .72; white-space: nowrap; }
.busiest-card h2 { font-family: var(--display); font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.05; margin: .5rem 0 1rem; color: var(--lime); }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; height: 120px; }
.week-bars div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .35rem; font-weight: 800; font-size: .85rem; }
.week-bars i { width: 100%; height: var(--h); min-height: 4px; background: var(--lime); border-radius: 6px; }

@media (max-width: 620px) {
  .invite-card { align-items: flex-start; flex-direction: column; }
  .profiles { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 1rem; }
  .friend-profile { display: block; grid-row: auto; }
}
