/* Wake the Fred Up. Fred's brand: cream, navy, sage, brass. Flat fills, no gradients,
   no shadows, and no animation of any kind. */
@font-face { font-family: "Inter Variable"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4 Variable"; src: url("/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }

:root {
  --bg: #F3EEE3; --surface: #FBF8F1; --surface-2: #ECE5D6; --line: #D9D0BE;
  --ink: #0F2538; --ink-2: #3E4C59; --ink-3: #5A6672;
  --primary: #0F2538; --on-primary: #F6F1E6;
  --stop: #8F2D2D; --on-stop: #FFF8EE;
  --sage-100: #E1E7D8; --sage-600: #52684B; --brass: #B08D4A; --brass-ink: #6E5320;
  --notice-bg: #F1E6CC; --notice-ink: #4A3A12; --urgent-bg: #EBD9CF; --urgent-ink: #5A2616;
  --focus: #1F5FA8;
  /* scene colors */
  --sky-night: #0F2538; --moon: #E9E1CC; --star: #E9E1CC; --hill-far-night: #1D3A4C; --hill-near-night: #163040;
  --sky-day: #F1E4C3; --sun: #B08D4A; --hill-far-day: #CAC5A6; --hill-near-day: #9DB08F; --ring: #B08D4A;
  --fred-filter: none;
  --radius: 20px; --tap: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120E; --surface: #201C17; --surface-2: #2A251E; --line: #3A342B;
    --ink: #ECE4D3; --ink-2: #C4B9A4; --ink-3: #A69C88;
    --primary: #D9CDB3; --on-primary: #15120E;
    --stop: #E7A08F; --on-stop: #15120E;
    --sage-100: #26302A; --sage-600: #A9BDA0; --brass: #CFAE6B; --brass-ink: #DCC08A;
    --notice-bg: #2E2717; --notice-ink: #E9D6A6; --urgent-bg: #3A2119; --urgent-ink: #F0C7B5;
    --focus: #9CC3F0;
    --sky-night: #1A2C3D; --moon: #D8CFB8; --star: #D8CFB8; --hill-far-night: #223C4D; --hill-near-night: #19303F;
    --sky-day: #3A2F1C; --sun: #CFAE6B; --hill-far-day: #3C4A3A; --hill-near-day: #2D3B2E; --ring: #CFAE6B;
    --fred-filter: brightness(0.9);
  }
}
* { box-sizing: border-box; animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.5 "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(36px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
}
main, .top { max-width: 540px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
img { display: block; }
[hidden] { display: none !important; }
h1, h2 { font-family: "Source Serif 4 Variable", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -0.01em; }

.top { display: flex; align-items: center; gap: 12px; padding-top: 18px; padding-bottom: 10px; }
.avatar img { width: 40px; height: 40px; border-radius: 50%; filter: var(--fred-filter); }
.top h1 { font-size: 22px; line-height: 1.1; margin: 0; flex: 1; }
.link { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.link.on .dot { background: var(--sage-600); }
.link.off .dot { background: var(--stop); }

h2 { font-size: 22px; line-height: 1.2; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }

/* ---- hero ---- */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0 14px; }
.scene { position: relative; height: 150px; }
.art { position: absolute; inset: 0; overflow: hidden; border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.sky { display: block; width: 100%; height: 100%; }
.ring { position: absolute; left: 50%; bottom: 22px; border: 2px solid var(--ring); border-radius: 50%; display: none; transform: translate(-50%, 50%); opacity: 0.55; }
.r1 { width: 170px; height: 170px; } .r2 { width: 216px; height: 216px; opacity: 0.38; } .r3 { width: 262px; height: 262px; opacity: 0.24; }
.fred { position: absolute; left: 50%; bottom: -44px; width: 128px; height: 128px; margin-left: -64px; }
.fred img { width: 128px; height: 128px; filter: var(--fred-filter); }

.sky-bg { fill: var(--sky-night); } .stars circle { fill: var(--star); } .stars { opacity: 0.8; }
.sun { fill: var(--moon); transform-box: fill-box; transform-origin: center; transform: scale(0.52) translateY(10px); }
.hill-far { fill: var(--hill-far-night); } .hill-near { fill: var(--hill-near-night); }
.hero[data-scene="day"] .sky-bg, .hero[data-scene="calling"] .sky-bg { fill: var(--sky-day); }
.hero[data-scene="day"] .stars, .hero[data-scene="calling"] .stars { display: none; }
.hero[data-scene="day"] .sun, .hero[data-scene="calling"] .sun { fill: var(--sun); transform: none; }
.hero[data-scene="day"] .hill-far, .hero[data-scene="calling"] .hill-far { fill: var(--hill-far-day); }
.hero[data-scene="day"] .hill-near, .hero[data-scene="calling"] .hill-near { fill: var(--hill-near-day); }
.hero[data-scene="calling"] .ring { display: block; }

.hero-body { padding: 58px 20px 22px; }
.pill { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--surface-2); color: var(--ink-3); }
.pill:empty { display: none; }
.pill.good { background: var(--sage-100); color: var(--sage-600); }
.pill.warn { background: var(--notice-bg); color: var(--notice-ink); }
.pill.bad { background: var(--urgent-bg); color: var(--urgent-ink); }
.hero h2 { font-size: clamp(26px, 7.6vw, 32px); line-height: 1.12; margin: 0 0 10px; }
.hero #detail { color: var(--ink-2); font-size: 17px; margin-bottom: 0; }
.actions { display: grid; gap: 12px; margin-top: 22px; }
.actions:empty { display: none; margin: 0; }

.btn {
  appearance: none; display: block; width: 100%; min-height: var(--tap); padding: 12px 18px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 650 17px/1.2 "Inter Variable", system-ui, sans-serif; text-align: center; cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.danger { background: var(--stop); color: var(--on-stop); border-color: var(--stop); }
.btn.quiet { background: transparent; color: var(--ink-2); font-weight: 600; }
.btn:disabled { opacity: 0.55; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.banner { margin: 12px 0 0; padding: 14px 16px; border-radius: 14px; font-weight: 600; background: var(--notice-bg); color: var(--notice-ink); }
.banner.bad { background: var(--urgent-bg); color: var(--urgent-ink); }

/* ---- wake times ---- */
summary { cursor: pointer; list-style: none; display: block; min-height: 32px; }
summary::-webkit-details-marker { display: none; }
#times > summary { display: flex; flex-direction: column; gap: 2px; padding-right: 28px; position: relative; }
#times > summary::after { content: "+"; position: absolute; right: 2px; top: 0; font-size: 26px; line-height: 1; color: var(--ink-3); }
#times[open] > summary::after { content: "\2212"; }
.s-title { font-weight: 700; font-size: 18px; }
.s-sub { color: var(--ink-3); font-size: 15px; }
details.more { margin: 10px 0 6px; border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary { font-weight: 600; font-size: 16px; color: var(--ink-2); }
form label { display: block; margin: 14px 0 0; font-size: 15px; color: var(--ink-3); font-weight: 600; }
form input {
  display: block; width: 100%; margin-top: 6px; min-height: 50px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 500 17px/1.2 "Inter Variable", system-ui, sans-serif;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#times-form .btn, #login-form .btn { margin-top: 18px; }
#times-form .btn.quiet { margin-top: 10px; }
.hint { color: var(--ink-3); font-size: 14px; margin: 10px 0 0; }
.error { color: var(--stop); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }

/* ---- recent mornings ---- */
.recent { list-style: none; margin: 4px 0 6px; padding: 0; }
.recent > li { padding: 13px 0; border-top: 1px solid var(--line); }
.recent > li:first-child { border-top: 0; }
.recent .row-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.recent .calls { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); color: var(--ink-3); font-size: 14px; }
.recent .calls li { padding: 2px 0; }
.recent .when { font-weight: 650; display: block; }
.recent .tag { color: var(--ink-3); font-size: 14px; display: block; font-weight: 500; }
.recent .what { display: flex; align-items: center; gap: 8px; font-weight: 600; text-align: right; }
.recent .glyph { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--ink-3); flex: none; }
.recent .good .glyph { background: var(--sage-100); color: var(--sage-600); }
.recent .bad .glyph { background: var(--urgent-bg); color: var(--urgent-ink); }
.recent .empty { display: block; color: var(--ink-3); }
.foot { color: var(--ink-3); font-size: 13px; text-align: center; margin: 20px 0 0; }

/* ---- sign in ---- */
.login { text-align: center; padding-top: 28px; }
.fred-login img { width: 120px; height: 120px; margin: 0 auto 8px; filter: var(--fred-filter); }
.login form { text-align: left; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 508px; background: var(--ink); color: var(--bg); padding: 14px 16px; border-radius: 14px; font-weight: 600; z-index: 10; }
.toast.error { background: var(--stop); color: var(--on-stop); }
@media (max-width: 360px) { .row { grid-template-columns: 1fr; } }
