@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f3ecdf;
  --paper-2: #faf6ee;
  --ink: #1d1914;
  --muted: #5e564c;
  --line: rgba(48, 34, 18, 0.14);
  --green: #17613c;
  --green-wash: #e3f3e8;
  --green-line: #b7dcc4;
  --amber: #7a5410;
  --amber-wash: #f8edc8;
  --amber-line: #e4cd88;
  --red: #8d312b;
  --red-wash: #f8e4df;
  --red-line: #e7b7b0;
  --shadow: 0 18px 50px rgba(48, 32, 16, 0.16);
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --han: "Source Sans 3", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  scroll-padding-bottom: 120px;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% -10%, #fffaf3 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #f0e0cc 0%, transparent 46%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
}

body.lock {
  overflow: hidden;
}

.skip {
  position: absolute;
  left: 12px;
  top: 8px;
  transform: translateY(-140%);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 80;
}

.skip:focus {
  transform: none;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-top: 22px;
}

.site-header {
  padding: 8px 0 14px;
}

.private {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

h1,
h2,
h3,
.year-name,
.month-name,
.card-month,
.pillar-name,
.han {
  font-family: var(--serif);
  font-optical-sizing: auto;
}

h1 {
  margin: 0;
  font-size: clamp(2.15rem, 7vw, 3.5rem);
  font-weight: 620;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.year-name {
  margin: 8px 0 0;
  font-size: 1.25rem;
  font-weight: 520;
  color: var(--red);
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h3 {
  margin: 1.35rem 0 0.45rem;
  font-size: 1.22rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 0.7rem;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.jump {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -16px 8px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}

.jump a {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.layout {
  padding-top: 18px;
}

.chart {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 12px;
  margin-bottom: 8px;
}

.chart-id {
  margin: 0 0 4px;
  color: var(--muted);
}

.pillar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.pillar {
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px 8px;
  border: 1px solid var(--line);
}

.pillar-role,
.kicker,
.fact dt {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pillar-name {
  margin: 2px 0 0;
  font-size: 1.25rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.han {
  margin: 0;
  font-family: var(--han);
  font-size: 1.35rem;
  font-weight: 520;
  line-height: 1.2;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 4px 0 8px;
}

.fact dt {
  margin-bottom: 2px;
}

.fact dd {
  margin: 0;
}

.fact-wide dd {
  font-size: 1.08rem;
}

.topics {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.section {
  margin: 0 0 40px;
}

.year-lead {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  line-height: 1.4;
  letter-spacing: -0.02em;
  max-width: 40rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.legend-item {
  white-space: nowrap;
}

.legend-dot {
  color: var(--muted);
}

.map-wrap h3 {
  margin-top: 0.4rem;
}

.tap-hint {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.month {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  min-height: 0;
  padding: 7px 8px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.month.is-green {
  background: var(--green-wash);
  border-color: var(--green-line);
}

.month.is-yellow {
  background: var(--amber-wash);
  border-color: var(--amber-line);
}

.month.is-red {
  background: var(--red-wash);
  border-color: var(--red-line);
}

.month.is-now {
  box-shadow: inset 0 0 0 2px var(--red);
}

.month[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.month-light {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.month.is-green .month-light { color: var(--green); }
.month.is-yellow .month-light { color: var(--amber); }
.month.is-red .month-light { color: var(--red); }

.month-name {
  margin-top: 4px;
  font-size: 1.4rem;
  font-weight: 620;
  line-height: 1;
  letter-spacing: -0.03em;
}

.month-animal {
  color: var(--muted);
  font-size: 0.92rem;
}

.month-blurb {
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.84rem;
  line-height: 1.25;
  font-weight: 600;
}

.badge {
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
}

.badge-now { color: var(--red); }
.badge-note { color: var(--amber); }

.bands {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.band {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.band-push { background: var(--green-wash); border-color: var(--green-line); }
.band-low { background: var(--red-wash); border-color: var(--red-line); }
.band-care { background: var(--amber-wash); border-color: var(--amber-line); }

.inline-month {
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: none;
  border: none;
  padding: 2px 1px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.chances,
.traps,
.plain-list,
.questions,
.optional,
.rules {
  margin: 0;
  padding-left: 1.35rem;
}

.chances li,
.traps li,
.plain-list li,
.questions li,
.optional li {
  margin: 0 0 10px;
  padding-left: 4px;
}

.traps li {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  list-style-position: outside;
}

.rule-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--ink);
  background: rgba(255, 252, 247, 0.7);
  border-radius: 0 12px 12px 0;
  max-width: 40rem;
}

.timeline,
.touchy {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li,
.touchy li {
  display: grid;
  grid-template-columns: minmax(9.2rem, 11rem) 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.timeline li.is-red strong {
  color: var(--red);
}

.optional {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 4px 2rem;
}

.questions li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  list-style-position: outside;
}

.one-look {
  display: grid;
  gap: 10px;
}

.look {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
}

.look-yes { background: var(--green-wash); }
.look-no { background: var(--red-wash); }

.if-panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(48, 32, 16, 0.1);
}

.if-toggle {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 12px 16px 10px;
  cursor: pointer;
  min-height: 64px;
}

.if-title-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
}

.if-title {
  margin-right: auto;
}

.if-title {
  font-family: var(--serif);
  font-weight: 620;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.if-count {
  flex: none;
  min-width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 700;
}

.if-title-row::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-2px) rotate(45deg);
}

.if-panel.is-open .if-title-row::after {
  transform: translateY(2px) rotate(225deg);
}

.rules {
  padding: 0 16px 16px 2.1rem;
}

.rules li {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.rules li::marker {
  font-family: var(--serif);
  font-weight: 620;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(28, 23, 18, 0.42);
  border: 0;
  padding: 0;
}

.scrim[hidden] {
  display: none;
}

@media (max-width: 1039px) {
  .layout {
    padding-bottom: 120px;
  }

  .if-panel {
    position: fixed;
    z-index: 32;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .if-panel:not(.is-open) .if-body {
    display: none;
  }

  .if-panel.is-open {
    max-height: min(86dvh, 760px);
    display: flex;
    flex-direction: column;
  }

  .if-panel.is-open .if-body {
    overflow: auto;
    min-height: 0;
  }
}

@media (min-width: 1040px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 332px;
    gap: 28px;
    align-items: start;
  }

  .if-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(48, 32, 16, 0.05);
  }

  .if-toggle {
    cursor: default;
  }

  .if-title-row::after {
    display: none;
  }

  .if-body {
    display: block;
  }
}

dialog.sheet {
  border: none;
  padding: 0;
  color: inherit;
  background: var(--paper);
}

dialog.sheet[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

dialog.sheet::backdrop {
  background: rgba(28, 23, 18, 0.48);
}

dialog.sheet[data-light="green"] { border-top: 6px solid var(--green); }
dialog.sheet[data-light="yellow"] { border-top: 6px solid var(--amber); }
dialog.sheet[data-light="red"] { border-top: 6px solid var(--red); }

.sheet-toolbar,
.sheet-pager {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--paper-2);
}

.sheet-toolbar {
  border-bottom: 1px solid var(--line);
}

.sheet-pager {
  border-top: 1px solid var(--line);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

#sheet-close,
.sheet-pager button {
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
}

.sheet-pager button {
  flex: 1;
}

.sheet-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 18px 28px;
}

.card-head {
  margin-bottom: 8px;
}

.card-status {
  margin: 0;
  font-weight: 700;
}

.card.is-green .card-status { color: var(--green); }
.card.is-yellow .card-status { color: var(--amber); }
.card.is-red .card-status { color: var(--red); }

.card-title {
  margin: 8px 0 0;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.card-month {
  font-weight: 680;
}

.card-note {
  margin: 8px 0 0;
  font-style: italic;
  color: var(--muted);
}

.one-line {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(1.28rem, 2.5vw, 1.55rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
}

.roads,
.pitfalls {
  margin: 0;
  padding-left: 1.3rem;
}

.road,
.pitfalls li,
.pitfalls p {
  margin: 0 0 10px;
}

.road {
  padding: 10px 12px;
  border-radius: 12px;
  list-style-position: outside;
  background: rgba(255, 252, 247, 0.65);
}

.road-best { background: var(--green-wash); }
.road-mistake { background: var(--red-wash); }
.road-kind { display: block; margin-bottom: 2px; }

.habit-box {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-wash);
}

.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.score {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 650;
  font-size: 0.95rem;
  border: 1px solid var(--line);
}

.score.is-green { background: var(--green-wash); }
.score.is-yellow { background: var(--amber-wash); }
.score.is-red { background: var(--red-wash); }

.marks {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.marks li {
  margin: 0 0 4px;
}

.marks-hurt {
  margin-bottom: 0;
}

.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;
}

.noscript {
  width: min(40rem, calc(100% - 32px));
  margin: 16px auto;
}

@media (max-width: 719px) {
  dialog.sheet {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
  }
}

@media (min-width: 720px) {
  .pillar-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .facts {
    grid-template-columns: 1fr 1fr;
  }

  .fact-wide {
    grid-column: 1 / -1;
  }

  .map {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bands,
  .one-look {
    grid-template-columns: repeat(3, 1fr);
  }

  .one-look {
    grid-template-columns: 1fr 1fr;
  }

  dialog.sheet {
    width: min(680px, calc(100% - 48px));
    height: min(860px, calc(100% - 48px));
    max-width: calc(100% - 48px);
    max-height: calc(100% - 48px);
    margin: auto;
    border-radius: 22px;
    background: var(--paper);
    box-shadow: var(--shadow);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .month {
    transition: transform 0.15s ease;
  }

  .month:hover {
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .month {
    transition: none;
  }
}

@media (max-width: 380px) {
  .timeline li,
  .touchy li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
