/* The Christmas Planner: palette, type and components.
   Colors are the Christmas palette from CLAUDE.md. Sizes come from the
   Claude Design handoff (390px phone, 1440px desktop). */

/* ---------- Palette ---------- */

:root {
  color-scheme: light;
  --paper: #f7f3ec;
  --surface: #fffdf8;
  --sunk: #eee7db;
  --line: #e2d8c8;
  --field: #857868;
  --ink: #1c211d;
  --ink-muted: #5e645e;
  --evergreen: #1f4a3a;
  --on-evergreen: #ffffff;
  --cranberry: #8e2a33;
  --brass: #9a7432;
  /* Status colors (BeautifullyDrafted), always paired with a word and an icon */
  --warning: #8a5a12;
  --warning-bg: #f8ebd5;
  --danger: #9b2c2c;
  --danger-bg: #f6e1dd;
  /* Snowy header backdrop */
  --sky1: #e8dfcf;
  --sky2: #f1ebe0;
  --glow: #ffffff;
  --glint: #e6cf9e;
  --flake: #ffffff;
  --scrim: rgba(243, 238, 229, 0.6);
  --hero-muted: #4f554f;
  --shadow: 0 1px 2px rgba(28, 33, 29, 0.06), 0 10px 28px rgba(28, 33, 29, 0.08);

  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Jost', system-ui, sans-serif;
  --font-eyebrow: 'Bodoni Moda', Georgia, serif;
  --tabbar-h: 84px;
  --sidebar-w: 260px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #121815;
    --surface: #1a221e;
    --sunk: #0d1210;
    --line: #2e3a33;
    --field: #7f8a82;
    --ink: #f1ebdf;
    --ink-muted: #b3aea2;
    --evergreen: #8fc4a6;
    --on-evergreen: #10241b;
    --cranberry: #ec9aa2;
    --brass: #d4b273;
    --warning: #e8c27a;
    --warning-bg: #3a2c12;
    --danger: #f0a3a3;
    --danger-bg: #3a1a1a;
    --sky1: #0a1410;
    --sky2: #122019;
    --glow: #33443a;
    --glint: #4e4428;
    --flake: #56645b;
    --scrim: rgba(10, 20, 16, 0.72);
    --hero-muted: #c9c4b9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.4);
  }
}

/* The manual theme switch (Settings) sets data-theme on <html>. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #121815;
  --surface: #1a221e;
  --sunk: #0d1210;
  --line: #2e3a33;
  --field: #7f8a82;
  --ink: #f1ebdf;
  --ink-muted: #b3aea2;
  --evergreen: #8fc4a6;
  --on-evergreen: #10241b;
  --cranberry: #ec9aa2;
  --brass: #d4b273;
  --warning: #e8c27a;
  --warning-bg: #3a2c12;
  --danger: #f0a3a3;
  --danger-bg: #3a1a1a;
  --sky1: #0a1410;
  --sky2: #122019;
  --glow: #33443a;
  --glint: #4e4428;
  --flake: #56645b;
  --scrim: rgba(10, 20, 16, 0.72);
  --hero-muted: #c9c4b9;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.4);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 23px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--cranberry);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--evergreen);
  outline-offset: 2px;
}
::selection {
  background: color-mix(in srgb, var(--evergreen) 25%, transparent);
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- App frame ---------- */

.app {
  height: 100%;
  display: flex;
}
.main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  outline: none;
}
.app.is-phone .main {
  scrollbar-width: none;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
.app.is-phone .main::-webkit-scrollbar {
  display: none;
}

/* Phone page: 24px gutters; on wider screens the column is capped. */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.app.is-desktop .page {
  max-width: none;
  margin: 0;
  padding: 0 56px 56px;
}
.app.is-desktop .page > :not(.hero),
.app.is-desktop .page > .hero > :not(.backdrop):not(.hero-accent) {
  max-width: 640px;
}
.page-desktop {
  max-width: 1180px;
  padding: 52px 56px 56px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ---------- Snowy header ---------- */

.hero {
  position: relative;
  margin: 0 -24px;
  padding: max(63px, calc(env(safe-area-inset-top, 0px) + 16px)) 24px 34px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
  --ink-muted: var(--hero-muted);
}
.app.is-desktop .page > .hero {
  margin: 0 -56px;
  padding: 96px 56px 46px;
}
.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-accent {
  position: absolute;
  z-index: 2;
  display: flex;
}
.hero-accent svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 72%, var(--paper) 100%);
  pointer-events: none;
}
.backdrop > * {
  position: absolute;
}
.backdrop .bokeh,
.backdrop .dot {
  border-radius: 50%;
}
.backdrop .hanger {
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
.backdrop .hanger-string {
  width: 1px;
  background: var(--brass);
  opacity: 0.7;
}
.backdrop .scrim {
  inset: 0;
  background: linear-gradient(90deg, var(--scrim) 0%, var(--scrim) 35%, transparent 85%);
}
.backdrop .drift {
  border-radius: 50%;
  background: var(--paper);
}
.backdrop .drift-a {
  left: -30%;
  right: 25%;
  bottom: -70px;
  height: 130px;
}
.backdrop .drift-b {
  left: 20%;
  right: -30%;
  bottom: -80px;
  height: 140px;
}
.backdrop .floor {
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  background: var(--paper);
}

/* ---------- Type ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-eyebrow);
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--cranberry);
}
.eyebrow.is-muted {
  color: var(--ink-muted);
}
.diamond {
  width: 5px;
  height: 5px;
  flex: none;
  background: var(--brass);
  transform: rotate(45deg);
}
.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.title em {
  font-style: italic;
  font-weight: 500;
  color: var(--cranberry);
}
.title.is-desktop {
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.012em;
}
.h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
}
.figure {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
}
.muted {
  color: var(--ink-muted);
}
.meta {
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-muted);
}
.lead {
  margin: 0;
  color: var(--ink-muted);
}
.label-caps {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 16px;
}
.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}
.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.section-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-head-title .accent {
  width: 24px;
  height: 24px;
  flex: none;
  display: flex;
}
.link-quiet {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.link-quiet:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* A placeholder for something a later update adds. */
.later {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0;
  font-size: 14px;
  line-height: 21px;
  color: var(--ink-muted);
}
.later .diamond {
  position: relative;
  top: -2px;
}

/* ---------- Buttons ---------- */

.btn {
  min-height: 48px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}
.btn svg {
  flex: none;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn.is-small {
  min-height: 44px;
}
.btn.is-desktop {
  min-height: 42px;
  padding: 0 18px;
}
.btn-primary {
  background: var(--evergreen);
  color: var(--on-evergreen);
  border-color: var(--evergreen);
}
.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--evergreen) 86%, var(--ink));
}
/* Control outlines use the field color so they reach 3:1. */
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--field);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--ink);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  padding: 0 8px;
}
.btn-ghost:hover {
  color: var(--ink);
}
.btn-block {
  width: 100%;
}
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-row > .btn {
  flex: 1 1 200px;
}

/* ---------- Cards and the arch ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.card.is-padded {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.arch {
  position: relative;
  border: 1.25px solid var(--brass);
}
.arch-inner {
  position: absolute;
  border: 0.75px solid var(--brass);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--cranberry);
}

.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--sunk);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--evergreen);
  border-radius: inherit;
}

/* ---------- Dashboard ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
.dash-hero {
  grid-row: span 2;
  position: relative;
  overflow: hidden;
  padding: 52px 28px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  --ink-muted: var(--hero-muted);
}
.dash-hero > :not(.backdrop):not(.hero-accent) {
  position: relative;
  z-index: 1;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.stat-row > div {
  display: flex;
  flex-direction: column;
}
.stat-row > div + div {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.date-row {
  display: flex;
  gap: 14px;
  align-items: center;
}
.date-tile {
  width: 50px;
  height: 54px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.date-tile-mon {
  font-family: var(--font-eyebrow);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 12px;
  padding-left: 2px;
}
.date-tile-day {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.1;
}

/* ---------- Start Here ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.step-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step-no {
  width: 36px;
  height: 40px;
  flex: none;
  border: 1px solid var(--brass);
  border-radius: 18px 18px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}
.step-no.is-done {
  background: var(--evergreen);
  border-color: var(--evergreen);
  color: var(--on-evergreen);
}
.step-done {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--evergreen);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 4px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--field);
  background: var(--surface);
  font-size: 14px;
}
.chip button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chip button:hover {
  background: var(--sunk);
  color: var(--ink);
}
.tip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.tip ol {
  margin: 0;
  padding-left: 20px;
}
.privacy {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  font-size: 14.5px;
  line-height: 21px;
}
.privacy svg {
  flex: none;
  margin-top: 2px;
  color: var(--evergreen);
}

/* ---------- Forms ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row > .field {
  flex: 1 1 140px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 13.5px;
  font-weight: 500;
}
.input {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--field);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.input-money {
  position: relative;
  display: flex;
}
.input-money span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
}
.input-money .input {
  padding-left: 28px;
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--field);
  background: var(--surface);
}
.seg-opt {
  flex: 1 1 auto;
  white-space: nowrap;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.seg-opt:hover:not([aria-checked='true']) {
  background: var(--sunk);
}
.seg-opt[aria-checked='true'] {
  background: var(--evergreen);
  color: var(--on-evergreen);
}

.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
}
.notice svg {
  flex: none;
  margin-top: 2px;
}
.notice.is-ok {
  background: color-mix(in srgb, var(--evergreen) 12%, var(--surface));
  color: var(--ink);
}
.notice.is-ok svg {
  color: var(--evergreen);
}
.notice.is-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.notice.is-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---------- More ---------- */

.more-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.more-row:hover {
  background: color-mix(in srgb, var(--sunk) 60%, transparent);
}

/* ---------- Navigation ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 6px env(safe-area-inset-bottom, 0px);
  min-height: var(--tabbar-h);
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 44px;
  color: var(--ink-muted);
  text-decoration: none;
}
.tab[aria-current='page'] {
  color: var(--evergreen);
}
.tab-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 14px;
}
.tab .diamond {
  width: 4px;
  height: 4px;
  visibility: hidden;
}
.tab[aria-current='page'] .diamond {
  visibility: visible;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  height: 100%;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 32px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-group-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 12px 6px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ink-muted);
  font-size: 15px;
  text-decoration: none;
}
.side-item:hover {
  background: var(--sunk);
  color: var(--ink);
}
.side-item[aria-current='page'] {
  background: var(--sunk);
  color: var(--evergreen);
  font-weight: 500;
}
.side-diamond {
  width: 6px;
  height: 6px;
  flex: none;
  transform: rotate(45deg);
  border: 1px solid var(--field);
}
.side-item[aria-current='page'] .side-diamond {
  background: var(--brass);
  border-color: var(--brass);
}

/* ---------- Dialog ---------- */

.modal {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal::backdrop {
  background: rgba(18, 24, 21, 0.45);
}
.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-body dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
}
.modal-body dt {
  color: var(--ink-muted);
}
.modal-body dd {
  margin: 0;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- Messages ---------- */

.toast {
  position: fixed;
  z-index: 30;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
@media (min-width: 1024px) {
  .toast {
    left: calc(var(--sidebar-w) + 56px);
    right: auto;
    bottom: 24px;
    margin: 0;
  }
}
