/* Nokes Builders — Briefs app
   Palette pulled from Website Redesign/nokes-builders-mockup.html
   Light mode is the default; dark mode follows system, override via toggle. */

:root {
  --teal: #264e46;
  --teal-deep: #173028;
  --orange: #d3672a;
  --orange-deep: #b04f1e;

  /* Light theme defaults */
  --bg: #fdfaf5;
  --surface: #ffffff;
  --surface-2: #f6f1ea;
  --ink: #1c1c1c;
  --ink-2: #3a3a3a;
  --muted: #6a6a6a;
  --line: #e7dfd2;
  --accent: var(--orange);
  --accent-strong: var(--orange-deep);
  --brand: var(--teal);
  --brand-strong: var(--teal-deep);
  --shadow: 0 1px 2px rgba(28,28,28,.05), 0 8px 24px rgba(28,28,28,.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1916;
    --surface: #16221e;
    --surface-2: #1a2924;
    --ink: #f0e9da;
    --ink-2: #d4cdbe;
    --muted: #8a9590;
    --line: #25342f;
    --accent: #e07a3d;
    --accent-strong: #ef9357;
    --brand: #6da293;
    --brand-strong: #8fbcae;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1916;
  --surface: #16221e;
  --surface-2: #1a2924;
  --ink: #f0e9da;
  --ink-2: #d4cdbe;
  --muted: #8a9590;
  --line: #25342f;
  --accent: #e07a3d;
  --accent-strong: #ef9357;
  --brand: #6da293;
  --brand-strong: #8fbcae;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 .35em;
  color: var(--ink);
}
h1 { font-size: clamp(34px, 8vw, 48px); font-weight: 700; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

p { margin: 0 0 .8em; }
ul { list-style: none; padding: 0; margin: 0; }
button { font-family: inherit; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  max-width: 720px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}
.brand-mark {
  width: 22px;
  height: 26px;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange) 50%, var(--teal) 50%, var(--teal) 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  display: inline-block;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: scale(.95); }
.theme-toggle .icn-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icn-sun,
:root:not([data-theme="light"]) .theme-toggle .icn-sun { /* default keep sun in light, moon in dark via media */ }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icn-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icn-moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .icn-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icn-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icn-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icn-moon { display: none; }

/* Page container */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 80px;
}

/* Section heads */
.head {
  margin: 24px 0 14px;
}
.head.week-head { margin-top: 36px; }
.eyebrow {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.greeting {
  font-size: 16px;
  color: var(--muted);
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card .block {
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}
.card .block:first-child { border-top: none; }
.card .block h2 {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 12px;
}
.card-row { padding: 18px 20px; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 12px; }
.list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: baseline;
}
.list.plain li { display: block; }

.time {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--brand);
}
.list .body { color: var(--ink); }
.list .body strong { font-weight: 600; }
.list .body .ctx { color: var(--muted); display: block; font-size: 14px; margin-top: 2px; }

/* Job chip */
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--brand);
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: 2px;
}
.chip.upriver { background: rgba(38,78,70,.12); color: var(--brand); }
.chip.conklin { background: rgba(211,103,42,.14); color: var(--accent-strong); }
.chip.romans  { background: rgba(38,78,70,.18); color: var(--brand-strong); }
.chip.dq      { background: rgba(211,103,42,.10); color: var(--accent); }
.chip.urgent  { background: var(--accent); color: #fff; }

/* Week */
.week .day {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.week .day:first-child { border-top: none; }
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.day-head .name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
}
.day-head .date {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .04em;
}
.day-head .name.is-today { color: var(--accent); }
.day .items { display: flex; flex-direction: column; gap: 6px; }
.day .item {
  font-size: 15px;
  color: var(--ink-2);
}
.day .item .chip { margin-right: 6px; }
.day .empty { color: var(--muted); font-size: 14px; }

/* Show full week button */
button.ghost {
  display: block;
  width: calc(100% - 40px);
  margin: 14px 20px 18px;
  padding: 12px 16px;
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.ghost:hover { background: var(--surface-2); border-color: var(--brand); }

.day.collapsed { display: none; }

/* Footer */
.foot {
  margin-top: 32px;
  text-align: center;
  font-size: 13px;
}
.foot p { margin: 4px 0; }

/* Error */
.error {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 24px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

/* Wider screens — keep mobile feel but allow some breathing */
@media (min-width: 720px) {
  body { font-size: 18px; }
  h1 { font-size: 56px; }
}
