/* christofferonleave.se
   Calm midnight: dark violet sky, a little cyan, quiet glass.
   Layout is plain document flow. Grids only set columns, never rows,
   so collapsing to one column can't stack elements on top of each other. */

:root {
  color-scheme: dark;
  --night: #070a1a;
  --night-2: #0d1226;
  --ink: #f1eeff;
  --lavender: #c4b5fd;
  --muted: #bdb7e0;
  --dim: #9692b9;
  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --cyan: #38bdf8;
  --cyan-soft: #7dd3fc;
  --glass: rgba(255, 255, 255, .04);
  --glass-strong: rgba(255, 255, 255, .065);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .15);
  --radius: 22px;
  --gutter: clamp(16px, 4vw, 40px);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  font: 16px/1.6 var(--sans);
  background: var(--night);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--night); overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
::selection { background: rgba(139, 92, 246, .45); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan-soft); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; overflow-wrap: break-word; }

.skip { position: absolute; top: -100px; left: 16px; z-index: 50; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--night); font-weight: 600; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Background ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(50% 40% at 80% 0%, rgba(139, 92, 246, .16), transparent 70%),
    radial-gradient(40% 35% at 0% 45%, rgba(56, 189, 248, .06), transparent 70%),
    radial-gradient(120% 80% at 50% -10%, var(--night-2), var(--night) 60%);
}

/* ---------- Layout ---------- */
.shell { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; border-radius: 8px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(139, 92, 246, .12); box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .18); }
.brand-mark svg, .avatar svg { width: 24px; height: 24px; display: block; }
.bm-track { stroke: rgba(196, 181, 253, .22); stroke-width: 2.5; }
.bm-arc { stroke: var(--violet-soft); stroke-width: 3.5; stroke-linecap: round; }
.bm-core { fill: var(--cyan-soft); }
.brand-soft { color: var(--dim); font-weight: 450; }
.brand-dot { color: var(--cyan-soft); }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.local-time { display: inline-flex; align-items: center; gap: 8px; font: 500 13px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.lt-label { font-family: var(--sans); font-size: 13px; color: var(--dim); }

/* ---------- Shared ---------- */
.label, .message-label { font: 500 11px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.glass {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--glass-strong), rgba(255, 255, 255, .015) 50%, var(--glass));
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 30px 80px -50px rgba(0, 0, 0, .9);
}
.signal { display: inline-block; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan-soft); box-shadow: 0 0 10px rgba(125, 211, 252, .6); animation: pulse 3s ease-in-out infinite; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px 56px;
  padding: clamp(36px, 6vw, 72px) 0 clamp(32px, 5vw, 56px);
}
.hero-copy { min-width: 0; }
.eyebrow { font-size: 14px; color: var(--lavender); margin-bottom: 12px; }
h1 { font-weight: 650; font-size: clamp(36px, 1.6rem + 3vw, 56px); line-height: 1.08; letter-spacing: -.035em; }
h1 em { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; color: var(--lavender); }
.lede { max-width: 46ch; margin-top: 16px; font-size: clamp(16px, 15px + .3vw, 18px); line-height: 1.65; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; margin-top: 24px; padding: 4px 14px; border-radius: 999px; border: 1px solid rgba(125, 211, 252, .22); background: rgba(56, 189, 248, .06); font-size: 14px; color: #d8efff; }

/* Small year ring: April to December highlighted. Desktop/tablet only. */
.motif { position: relative; width: 200px; aspect-ratio: 1; }
.motif svg { display: block; width: 100%; height: 100%; }
.m-ticks { stroke: rgba(196, 181, 253, .35); stroke-width: 5; stroke-dasharray: 1.2 48.02; }
.m-track { stroke: rgba(196, 181, 253, .12); stroke-width: 2; }
.m-arc { stroke-width: 3; stroke-linecap: round; }
.m-start { fill: var(--violet-soft); stroke: var(--night); stroke-width: 2; }
.m-end { fill: var(--cyan-soft); stroke: var(--night); stroke-width: 2; }
.motif-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 500 10px/1.3 var(--mono); letter-spacing: .14em; color: var(--dim); text-align: center; }
.motif-label strong { font: 600 20px/1.1 var(--sans); letter-spacing: .01em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Sections ---------- */
.section { margin-top: clamp(56px, 8vw, 96px); }
.hero + .section { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; margin-bottom: 20px; }
.section-head h2 { font-weight: 600; font-size: clamp(22px, 1rem + 1.2vw, 30px); line-height: 1.2; letter-spacing: -.02em; }
.section-aside { font-size: 14px; color: var(--dim); }

/* ---------- Countdown ---------- */
.countdown-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.count-card { display: flex; flex-direction: column; padding: clamp(20px, 3vw, 36px); min-width: 0; }
.main-count { background: radial-gradient(70% 90% at 100% 0%, rgba(139, 92, 246, .14), transparent 60%), linear-gradient(160deg, var(--glass-strong), rgba(255, 255, 255, .015) 50%, var(--glass)); }
.main-count::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(167, 139, 250, .45), rgba(255, 255, 255, .04) 40%, rgba(255, 255, 255, .04) 60%, rgba(56, 189, 248, .35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.main-count .label { color: var(--lavender); }
.days-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; margin: 16px 0 20px; }
.days {
  font-weight: 650; font-size: clamp(64px, 24px + 9vw, 120px); line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 30%, #cbbcff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.days-word { font: italic clamp(24px, 18px + 1.2vw, 34px)/1 var(--serif); color: var(--lavender); }
.sub-count { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.unit { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(7, 10, 26, .35); }
.unit strong { font: 600 clamp(24px, 16px + 1.6vw, 36px)/1 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.unit span { font-size: 13px; color: var(--dim); }
.counting-aside { grid-column: 1 / -1; justify-self: end; max-width: 100%; margin-top: -2px; font: italic 14px/1.4 var(--serif); color: var(--dim); text-transform: none; overflow-wrap: break-word; }
.progress-block { margin-top: 24px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
#progress-text { font: 500 14px var(--mono); color: var(--lavender); font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; -webkit-appearance: none; appearance: none; background: rgba(255, 255, 255, .07); }
progress::-webkit-progress-bar { background: rgba(255, 255, 255, .07); border-radius: 999px; }
progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--violet-soft) 60%, var(--cyan)); }
progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--violet-soft) 60%, var(--cyan)); }
.progress-dates { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font: 500 11px var(--mono); letter-spacing: .08em; color: var(--dim); }

.return-card { background: radial-gradient(80% 70% at 100% 100%, rgba(56, 189, 248, .1), transparent 65%), linear-gradient(160deg, var(--glass-strong), rgba(255, 255, 255, .015) 50%, var(--glass)); }
.return-date { display: flex; align-items: center; gap: 16px; margin: 16px 0 auto; padding-bottom: 20px; }
.return-day { font: 650 clamp(56px, 36px + 4vw, 80px)/1 var(--sans); letter-spacing: -.04em; color: var(--lavender); }
.return-meta { display: flex; flex-direction: column; gap: 2px; font-size: 16px; color: var(--ink); }
.return-meta strong { font: 500 14px var(--mono); color: var(--cyan-soft); }
.return-foot { padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.return-foot strong { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.return-aside { margin-top: 4px; font: italic 15px/1.5 var(--serif); color: var(--dim); }

.journey { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; list-style: none; margin: 28px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.journey li { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-left: 22px; }
.chapter-dot { position: absolute; top: 7px; left: 0; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #4a4672; }
.journey strong { font-size: 16px; font-weight: 600; color: var(--muted); }
.chapter-when { font-size: 14px; color: var(--dim); }
.journey .current strong { color: var(--ink); }
.journey .current .chapter-dot { background: var(--cyan-soft); border-color: var(--cyan-soft); box-shadow: 0 0 0 4px rgba(125, 211, 252, .15); }

/* ---------- Ask ---------- */
#ask .section-head, .ask-card { max-width: 760px; }
.ask-card { overflow: hidden; }

.chat-area { display: flex; flex-direction: column; min-width: 0; padding: clamp(18px, 3vw, 28px); background: rgba(7, 10, 26, .45); }
.chat-top { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 10px; background: rgba(139, 92, 246, .14); box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .22); }
#chat-status { display: block; font-size: 13px; color: var(--dim); }
.chat-log { min-height: 180px; max-height: 380px; overflow-y: auto; overscroll-behavior: contain; padding: 16px 4px 4px 0; scrollbar-width: thin; scrollbar-color: #463d73 transparent; }
.chat-log:focus-visible { outline-offset: -2px; }
.chat-message { max-width: 92%; margin-bottom: 12px; padding: 12px 16px 14px; border: 1px solid var(--line); border-radius: 6px 18px 18px 18px; background: rgba(255, 255, 255, .04); overflow-wrap: anywhere; animation: rise .35s var(--ease) both; }
.chat-message.user { margin-left: auto; border-radius: 18px 6px 18px 18px; border-color: rgba(167, 139, 250, .28); background: rgba(139, 92, 246, .14); }
.message-label { font-size: 10.5px; color: var(--cyan-soft); }
.chat-message.user .message-label { color: var(--lavender); }
.chat-message p { margin: 4px 0 0; font-size: 16px; line-height: 1.6; white-space: pre-wrap; color: var(--ink); }
.intro-message p { margin-top: 0; }
.chat-message[aria-busy="true"] { border-style: dashed; }
.chat-message[aria-busy="true"] p { color: var(--muted); animation: breathe 1.8s ease-in-out infinite; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.suggestions button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(196, 181, 253, .22); background: rgba(255, 255, 255, .03); font-size: 14px; color: var(--muted); transition: background .2s, color .2s, border-color .2s; }
.suggestions button:hover { background: rgba(139, 92, 246, .14); border-color: rgba(196, 181, 253, .45); color: var(--ink); }
form { margin-top: auto; }
form label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
.input-wrap { position: relative; }
textarea { display: block; width: 100%; min-height: 92px; max-height: 240px; resize: vertical; padding: 14px 68px 14px 16px; border-radius: 16px; border: 1px solid rgba(196, 181, 253, .28); background: rgba(7, 10, 26, .8); font-size: 16px; line-height: 1.6; color: var(--ink); transition: border-color .2s, box-shadow .2s; }
textarea::placeholder { color: var(--dim); }
textarea:focus { outline: none; border-color: var(--violet-soft); box-shadow: 0 0 0 3px rgba(139, 92, 246, .22); }
textarea:focus-visible { outline: 2px solid var(--cyan-soft); outline-offset: 2px; }
textarea:disabled { opacity: .6; }
#send { position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--violet), #5f7fe0); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); transition: filter .2s; }
#send svg { width: 20px; height: 20px; }
#send:hover:not(:disabled) { filter: brightness(1.12); }
.form-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; font: 500 12px var(--mono); color: var(--dim); font-variant-numeric: tabular-nums; }
.text-button { min-height: 44px; padding: 0 2px; border: 0; background: none; font-size: 14px; color: var(--muted); text-decoration: underline; text-decoration-color: rgba(196, 181, 253, .35); text-underline-offset: 4px; }
.text-button:hover:not(:disabled) { color: var(--ink); text-decoration-color: var(--cyan-soft); }
.chat-error { margin-top: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(252, 165, 165, .35); background: rgba(248, 113, 113, .08); font-size: 14px; color: #fecaca; }

/* ---------- Footer ---------- */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin-top: clamp(56px, 8vw, 96px); padding: 24px 0 32px; border-top: 1px solid var(--line); font-size: 14px; color: var(--dim); }
.footer-brand { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; color: var(--ink); }
.footer-brand span { color: var(--dim); font-weight: 450; }
.footer p:not(.footer-back) { font: italic 15px var(--serif); }
.no-script { margin-top: 32px; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--night-2); }

/* ---------- Motion ---------- */
@keyframes pulse { 50% { opacity: .45; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes breathe { 50% { opacity: .5; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .countdown-grid { grid-template-columns: minmax(0, 1fr); }
  .return-date { margin-bottom: 0; }
}

@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .motif { display: none; }
  .local-time { display: none; }
}

@media (max-width: 560px) {
  :root { --radius: 18px; }
  .masthead { padding: 12px 0; }
  .journey { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sub-count { gap: 8px; }
  .unit { padding: 12px; border-radius: 12px; }
  .chat-message { max-width: 100%; }
  .chat-message.user { margin-left: 8%; }
}

@media (max-width: 400px) {
  .masthead { gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-soft { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 0 10px; font-size: 13px; }
  .unit span { font-size: 12px; }
  .progress-dates { font-size: 10px; letter-spacing: .04em; }
  .suggestions button { font-size: 13px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .days { color: CanvasText; background: none; -webkit-text-fill-color: CanvasText; }
}
