/* MILO - personal life OS. Brand v4: typography is king. */

/* ---------- tokens ---------- */
:root {
  --sienna: #C4632D;
  --sienna-soft: #D98A5C;
  --forest: #3A6B48;
  --purple: #7d33be;
  --cream: #FAF7F2;
  --charcoal: #1A1210;

  --bg: #FAF7F2;
  --bg-glow: #F3E8DC;
  --card: #FFFFFF;
  --ink: #3A2C25;
  --muted: #8A7A70;
  --subtle: #B5A79D;
  --line: rgba(58, 44, 37, 0.10);
  --accent: var(--sienna);

  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --spring: cubic-bezier(.34, 1.4, .44, 1);
  --ease: cubic-bezier(.25, .1, .25, 1);
}

/* time atmosphere: the app breathes with the day */
html[data-time="dawn"]   { --bg:#F7EFE8; --bg-glow:#F2DFCB; }
html[data-time="morning"]{ --bg:#FAF7F2; --bg-glow:#F3E8DC; }
html[data-time="midday"] { --bg:#FBF9F5; --bg-glow:#EFEAE0; }
html[data-time="golden"] { --bg:#F8F0E4; --bg-glow:#F0DCC0; }
html[data-time="dusk"], html[data-time="night"] {
  --bg:#1A1210; --bg-glow:#2A1B14; --card:#241813;
  --ink:#F5EFE6; --muted:#A89B93; --subtle:#6B5F58;
  --line: rgba(250, 247, 242, 0.09);
}
html[data-time="dusk"] { --bg:#211511; --bg-glow:#33201580; }

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; }
ul, ol { padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  min-height: 100dvh;
  transition: background 1.6s var(--ease), color .8s var(--ease);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

#app {
  max-width: 640px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 24px calc(96px + env(safe-area-inset-bottom));
}

/* ---------- type roles ---------- */
.ovl {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.serif { font-family: var(--serif); font-weight: 400; }
.display {
  font-family: var(--serif);
  font-size: clamp(42px, 11.5vw, 68px);
  line-height: 1.02; letter-spacing: -0.015em;
  text-wrap: balance;
}
.display em { font-style: italic; color: var(--accent); }

/* ---------- views ---------- */
.view { display: none; animation: rise .5s var(--ease) both; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

header.top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 34px;
}
header.top .wordmark { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; }
header.top .wordmark i { font-style: normal; color: var(--accent); }
header.top button { color: var(--subtle); padding: 8px; }
header.top button:hover { color: var(--ink); }

/* ---------- NOW ---------- */
.now-date { margin-bottom: 10px; display: flex; gap: 12px; align-items: baseline; }
.now-date .dot { color: var(--accent); }
.greeting { margin-bottom: 26px; }

.chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px; padding: 7px 14px; margin-bottom: 40px;
}
.chip b { font-family: var(--serif); font-size: 17px; font-weight: 400; }

.one { margin-bottom: 44px; }
.one .ovl { display: block; margin-bottom: 14px; }
.one-task {
  display: block; width: 100%; text-align: left;
  font-family: var(--serif); font-size: clamp(28px, 7vw, 40px);
  line-height: 1.15; letter-spacing: -0.01em;
  padding: 0 0 18px; border-bottom: 1px solid var(--line);
  transition: opacity .3s;
  position: relative;
}
.one-task::after {
  content: "tap when it is done";
  position: absolute; left: 0; bottom: -24px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--subtle);
  opacity: 0; transition: opacity .3s;
}
.one-task:hover::after, .one-task:focus-visible::after { opacity: 1; }
.one-task:active { opacity: .55; }
.one-empty { font-family: var(--serif); font-size: 26px; color: var(--muted); font-style: italic; }

.more { margin-bottom: 44px; }
.more-toggle { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.more-toggle:hover { color: var(--accent); }
.more-list { margin-top: 16px; display: grid; gap: 2px; }
.task-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 2px; border-bottom: 1px solid var(--line);
  font-size: 16.5px; line-height: 1.4;
  transition: opacity .25s;
}
.task-row:active { opacity: .5; }
.task-row .ring {
  flex: none; width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid var(--subtle); transition: all .25s var(--spring);
}
.task-row:hover .ring { border-color: var(--accent); }
.task-row .dom { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); }

/* capture */
.capture { margin: 8px 0 40px; text-align: center; }
#orb {
  width: 132px; height: 132px; display: block; margin: 0 auto 6px;
  border-radius: 50%;
  transition: transform .4s var(--spring);
}
#orb:active { transform: scale(.94); }
.orb-hint { font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--subtle); min-height: 16px; transition: color .3s; }
.orb-hint.live { color: var(--accent); }
.capture-line { display: flex; gap: 10px; margin-top: 22px; }
.capture-line input {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 13px 16px; font-size: 16px;
}
.capture-line input::placeholder { color: var(--subtle); }
.capture-line button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cream); background: var(--ink);
  border-radius: var(--r-m); padding: 0 18px;
}
html[data-time="dusk"] .capture-line button, html[data-time="night"] .capture-line button { color: var(--charcoal); background: var(--cream); }

.transcript {
  font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--muted);
  min-height: 0; margin-top: 14px; text-wrap: balance;
}

/* wins */
.wins { border-top: 1px solid var(--line); padding-top: 22px; }
.wins .ovl { display: block; margin-bottom: 12px; }
.wins ul { list-style: none; display: grid; gap: 8px; }
.wins li { font-family: var(--serif); font-size: 18px; }
.wins li::before { content: "· "; color: var(--forest); }
.land {
  margin-top: 26px; width: 100%;
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 14px; transition: all .3s;
}
.land:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- DAY ---------- */
.day-head { margin-bottom: 34px; }
.day-head h2 { font-family: var(--serif); font-size: clamp(34px, 9vw, 48px); line-height: 1.05; letter-spacing: -0.01em; margin-top: 8px; }
.rhythm { display: grid; gap: 0; margin-bottom: 40px; }
.slot {
  display: grid; grid-template-columns: 64px 1fr; gap: 18px;
  padding: 17px 0; border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.slot.past { opacity: .38; }
.slot.now-slot .t { color: var(--accent); }
.slot .t { font-family: var(--mono); font-size: 12px; letter-spacing: .05em; color: var(--muted); }
.slot .l { font-family: var(--serif); font-size: 21px; }
.slot .d { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.slot .d b { color: var(--ink); font-weight: 500; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px 22px; margin-bottom: 18px; }
.panel .ovl { display: block; margin-bottom: 10px; }
.panel h3 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin-bottom: 10px; }
.panel ul { list-style: none; display: grid; gap: 7px; font-size: 14.5px; color: var(--muted); }
.panel ul b { color: var(--ink); font-weight: 500; }
.panel .foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--subtle); font-style: italic; }

/* ---------- LIFE ---------- */
.life-head { margin-bottom: 30px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 40px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 17px 18px; text-align: left; min-height: 118px;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .3s var(--spring);
}
.tile:active { transform: scale(.97); }
.tile .name { font-family: var(--serif); font-size: 20px; display: flex; align-items: center; gap: 8px; }
.tile .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--forest); flex: none; }
.tile.urgent .pip { background: var(--sienna); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sienna) 15%, transparent); }
.tile .s { font-size: 13px; color: var(--muted); line-height: 1.45; flex: 1; }
.tile .n { font-family: var(--mono); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }

.dates { margin-bottom: 40px; }
.dates .ovl { display: block; margin-bottom: 8px; }
.date-row { display: flex; justify-content: space-between; align-items: baseline; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.date-row .l { font-family: var(--serif); font-size: 18px; }
.date-row .c { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.date-row .c b { color: var(--accent); font-weight: 500; }

.lanes { display: grid; gap: 26px; }
.lane .ovl { display: block; margin-bottom: 10px; }
.lane .gate { font-family: var(--mono); font-size: 10px; color: var(--subtle); text-transform: uppercase; letter-spacing: .08em; margin-left: auto; }
.lane .task-row.done-row { opacity: .6; }
.lane .task-row.done-row .ring { background: var(--forest); border-color: var(--forest); }

/* ---------- nav ---------- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
nav button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--subtle); padding: 12px 22px; border-radius: 999px;
  transition: color .25s;
}
nav button.on { color: var(--purple); }
nav button:hover { color: var(--ink); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; display: none; z-index: 40; }
.sheet-wrap.open { display: block; }
.sheet-wrap .scrim { position: absolute; inset: 0; background: rgba(20, 12, 8, .45); animation: fade .3s both; }
@keyframes fade { from { opacity: 0 } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 640px; margin: 0 auto;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 14px 24px calc(26px + env(safe-area-inset-bottom));
  animation: up .45s var(--spring) both;
  max-height: 82dvh; overflow: auto;
}
@keyframes up { from { transform: translateY(60%); opacity: .4 } }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 18px; }
.sheet h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; margin-bottom: 6px; }
.sheet .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.sheet .opt {
  display: block; width: 100%; text-align: left; font-size: 16px;
  padding: 14px 2px; border-bottom: 1px solid var(--line);
}
.sheet .opt:hover { color: var(--accent); }
.sheet label { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.sheet select { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: inherit; font-size: 14px; }
.sheet .brainfacts { font-size: 14px; color: var(--muted); line-height: 1.7; }
.sheet .brainfacts b { color: var(--ink); font-weight: 500; }

/* celebration */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-family: var(--serif); font-size: 18px; font-style: italic;
  background: var(--ink); color: var(--bg);
  padding: 11px 22px; border-radius: 999px; z-index: 70;
  animation: toast 2.6s var(--ease) both;
  white-space: nowrap;
}
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 12px) }
  12%, 82% { opacity: 1; transform: translate(-50%, 0) }
  100% { opacity: 0; transform: translate(-50%, -8px) }
}

@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
