:root {
  color-scheme: light;
  --gutter: clamp(1rem, 2.5vw, 2.5rem);
  --paper: #f6f3ec;
  --surface: #fffcf6;
  --ink: #202921;
  --muted: #4e5950;
  --line: #d9d6c9;
  --forest: #304e3f;
  --night: #0a1828;
  --gold: #f5dfa3;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
}

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

html { scroll-behavior: smooth; }

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
ul { padding: 0; margin: 0; list-style: none; }
button, textarea { font: inherit; }

:is(a, button, textarea):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
  border-radius: 3px;
}

.wrap {
  width: 100%;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed;
  z-index: 4;
  inset: 0.75rem auto auto 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.site-header {
  display: flex;
  min-height: 5.2rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.1rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
}

.brand-mark::before {
  width: 0.8rem;
  height: 0.95rem;
  border-bottom: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  border-radius: 0 80% 0 80%;
  background: #f5dfa355;
  transform: rotate(-30deg);
  content: "";
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3.6vw, 2.75rem);
}

.site-header nav a {
  padding-block: 0.5rem;
  color: var(--forest);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-header nav a:hover, .site-header nav a[aria-current], .secondary-action:hover {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.home .site-header {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  min-height: 5rem;
  color: #fff9ec;
}

.home .brand { gap: 0.9rem; }

.wordmark {
  font: italic 500 1.95rem/1 "Baskervville", Baskerville, Georgia, serif;
  letter-spacing: -0.055em;
}

.brand-name {
  padding-inline-start: 0.85rem;
  border-inline-start: 1px solid #fff9ec60;
  font-size: 0.9rem;
  letter-spacing: 0.09em;
}

.home .site-header nav a { color: inherit; }

.hero {
  position: relative;
  display: grid;
  min-height: clamp(31rem, 84vh, 64rem);
  min-height: clamp(31rem, min(86svh, 58vw), 64rem);
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background: var(--night);
  color: #fff9ed;
}

.hero-image, .hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image { object-fit: cover; object-position: 74% 57%; }

.hero::after {
  background:
    linear-gradient(180deg, #0610189c, transparent 25%, transparent 72%, #08121b52),
    linear-gradient(90deg, #07131cb5, #07131c55 37%, transparent 68%);
  content: "";
}

.hero-content {
  position: relative;
  padding: 7rem var(--gutter) 4rem;
}

.hero h1 {
  width: fit-content;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.05;
}

.hero h1 span {
  display: block;
  margin-bottom: 0.42em;
  font-size: clamp(1.65rem, 2.8vw, 3rem);
  letter-spacing: 0.12em;
}

.hero h1 em {
  display: block;
  color: #ffe8b5;
  font-size: clamp(4.25rem, 8.5vw, 9.25rem);
  font-style: normal;
  letter-spacing: 0.015em;
}

.hero p {
  max-width: 30em;
  margin-top: 1.45rem;
  color: #f2efe6;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.6rem;
  margin-top: 2rem;
}

.primary-action, .secondary-action {
  display: inline-block;
  padding-block: 0.7rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.primary-action {
  padding-inline: 1.45rem;
  border-radius: 2px;
  background: #fff0cd;
  color: #253228;
}

.primary-action:hover { background: #fff9e8; }
.primary-action:focus-visible { outline-color: var(--gold); }
.secondary-action { text-decoration: underline; text-underline-offset: 0.42em; }

.section {
  padding: clamp(2.25rem, 4vw, 4rem) var(--gutter);
  scroll-margin-top: 0.75rem;
}

.section-heading h2 {
  font: 600 clamp(2rem, 3.8vw, 3.9rem)/1.1 var(--serif);
  letter-spacing: -0.015em;
}

.tool-section {
  display: grid;
  grid-template-columns: minmax(8rem, 0.48fr) minmax(0, 2fr);
  align-items: center;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.tool-list, .note-list { display: grid; }
.tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3.5rem); }

.tool-card, .note-card {
  color: inherit;
  text-decoration: none;
}

.tool-card {
  display: grid;
  grid-template-columns: clamp(6rem, 10vw, 11.5rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.85rem, 2vw, 2rem);
}

.tool-card img { width: 100%; height: auto; }

.tool-card h3, .note-card h3 {
  font: 600 clamp(1.25rem, 2vw, 1.9rem)/1.4 var(--serif);
  text-wrap: balance;
}

.tool-card p { max-width: 16em; margin-top: 0.4rem; color: var(--muted); text-wrap: balance; }
.tool-card:hover h3, .note-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.24em; }

.notes-section { padding-bottom: clamp(3rem, 5vw, 5rem); }
.notes-section .section-heading { margin-bottom: 1.75rem; }

.note-list {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 1rem clamp(1.5rem, 3.5vw, 4rem);
  align-items: center;
}

.note-list li:first-child { grid-row: span 2; }
.note-list li + li { padding-block: 0.5rem; }
.note-list li:last-child { border-top: 1px solid var(--line); padding-top: 1.5rem; }

.note-card {
  display: grid;
  grid-template-columns: minmax(0, 0.87fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.note-list li:first-child .note-card { display: block; }
.note-list li:first-child h3 { margin-top: 0.65rem; }
.note-card img { width: 100%; height: auto; object-fit: cover; }
.note-list li + li img { aspect-ratio: 1.65; }

.home .site-footer { margin-top: 0; background: #e9e8dc; }

.site-footer {
  margin-top: clamp(3rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
  background: #ecece1;
}

.footer-main {
  padding-block: 2.15rem;
}

.footer-main h2 { font: 700 1.25rem/1.4 var(--serif); }
.footer-main p { margin-top: 0.45rem; color: var(--muted); }

.footer-filing {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding-block: 1.25rem 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.footer-filing a { color: var(--forest); text-underline-offset: 0.25em; }
.site-footer > .footer-filing { border-top: 0; }

.inner-page { flex: 1; padding-top: clamp(1rem, 3.8vw, 3rem); }

.inner-page h1 {
  margin-bottom: 1.65rem;
  font: 700 clamp(2.1rem, 5vw, 3.35rem)/1.2 var(--serif);
}

.workshop {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 1.2rem;
}

.work-panel {
  padding: clamp(1rem, 3vw, 2rem);
  scroll-margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
}

.tool-heading {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}

.tool-heading img { width: 3.5rem; height: 3.5rem; border-radius: 0.5rem; }
.tool-heading h2 { font: 700 1.55rem/1.3 var(--serif); }

.mode-switch, .tool-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
}

.work-panel button {
  min-height: 2.75rem;
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--forest);
  cursor: pointer;
}

.work-panel button:hover { border-color: var(--forest); }
.work-panel button[aria-pressed="true"] { border-color: var(--forest); background: #e4eadf; }
.work-panel .solid-button { min-width: 5rem; border-color: var(--forest); background: var(--forest); color: #fffdf4; }
.work-panel .solid-button:hover { background: #203c2f; }
.work-panel .solid-button:focus-visible { outline-color: var(--forest); }

.timer-dial {
  --progress: 0%;
  display: grid;
  width: min(100%, 12.25rem);
  aspect-ratio: 1;
  margin: 1.35rem auto;
  padding: 0.42rem;
  border-radius: 50%;
  background: conic-gradient(var(--forest) var(--progress), #e4e6dc 0);
}

.timer-clock {
  display: grid;
  place-content: center;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
}

#timer-display { font-size: 2.55rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
#timer-status, .count-actions p { color: var(--muted); font-size: 0.875rem; }

.work-panel label { display: block; margin-bottom: 0.45rem; }

.work-panel textarea {
  display: block;
  width: 100%;
  padding: 0.75rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #fffefa;
  color: var(--ink);
}

.text-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-block: 1rem;
}

.text-totals > div { padding: 0.6rem 0.75rem; border-radius: 0.45rem; background: var(--paper); }
.text-totals dt { color: var(--muted); font-size: 0.875rem; }
.text-totals dd { margin: 0; font-size: 1.45rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.count-actions { justify-content: space-between; }

.note-index { display: flex; flex-wrap: wrap; gap: 0.65rem 1.25rem; margin-bottom: 1.65rem; }
.note-index a { color: var(--forest); text-underline-offset: 0.3em; }
.notebook { display: grid; gap: 1.2rem; }

.note-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: start;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1rem, 3vw, 2rem);
  scroll-margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--surface);
}

.note-entry img { width: 100%; height: auto; aspect-ratio: 1.65; border-radius: 0.45rem; object-fit: cover; }
.note-body { max-width: 42em; }
.note-body h2 { font: 700 clamp(1.3rem, 2.2vw, 1.75rem)/1.35 var(--serif); }
.note-body p { margin-top: 0.75rem; color: var(--muted); line-height: 1.85; }

@media (max-width: 900px) {
  .tool-section { grid-template-columns: 1fr; gap: 1.35rem; }
}

@media (max-width: 720px) {
  .site-header, .home .site-header { min-height: 4.1rem; }
  .brand, .home .brand { gap: 0.45rem; }
  .brand-mark { width: 1.65rem; }
  .wordmark { font-size: 1.55rem; }
  .brand-name { padding-inline-start: 0.45rem; font-size: 0.78rem; letter-spacing: 0; }
  .site-header nav { gap: 0.8rem; }
  .site-header nav a { font-size: 0.875rem; }

  .hero {
    min-height: clamp(29rem, 82vh, 46rem);
    min-height: clamp(29rem, 82svh, 46rem);
    align-items: end;
  }
  .hero-image { object-position: 90% 50%; }
  .hero::after {
    background: linear-gradient(180deg, #07131cc2, transparent 24%, transparent 39%, #07131c91 61%, #07131cfa);
  }
  .hero-content { padding: 9rem var(--gutter) clamp(2.25rem, 5svh, 4rem); }
  .hero h1 span { margin-bottom: 0.3em; font-size: 1.55rem; }
  .hero h1 em { font-size: clamp(3.45rem, 13.4vw, 5.75rem); }
  .hero p { margin-top: 0.9rem; }
  .hero-actions { margin-top: 1.25rem; }

  .tool-list, .note-list { grid-template-columns: 1fr; gap: 0; }
  .tool-list li + li, .note-list li + li { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
  .tool-card { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; }
  .notes-section .section-heading { margin-bottom: 1.25rem; }
  .note-list li:first-child { grid-row: auto; }
  .note-list li + li { padding-bottom: 0; }
  .note-card { grid-template-columns: 36% 1fr; gap: 1rem; }
  .note-card h3 { font-size: 1.1rem; }
  .note-list li:first-child h3 { font-size: 1.3rem; }
  .workshop, .note-entry { grid-template-columns: 1fr; }
  .note-entry img { aspect-ratio: 2; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-image { animation: artwork-arrive 1.25s cubic-bezier(0.2, 0.65, 0.3, 1) both; }
  .hero h1, .hero p, .hero-actions { animation: text-arrive 680ms cubic-bezier(0.2, 0.65, 0.3, 1) both; }
  .hero p { animation-delay: 100ms; }
  .hero-actions { animation-delay: 200ms; }
  .hero:focus-within :is(h1, p, .hero-actions) { animation: none; }
  .arrived { animation: card-arrive 520ms cubic-bezier(0.2, 0.65, 0.3, 1); }
  .arrived:focus { animation: none; }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tool-card img, .note-card img { transition: transform 240ms ease; }
  .tool-card:hover img, .note-card:hover img { transform: translateY(-3px); }
  .primary-action { transition: background 180ms ease, transform 180ms ease; }
  .primary-action:hover { transform: translateY(-2px); }
  .primary-action:active { transform: translateY(0); }
}

@keyframes artwork-arrive {
  from { transform: scale(1.045); }
  to { transform: scale(1); }
}

@keyframes text-arrive {
  from { opacity: 0.76; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-arrive {
  from { opacity: 0.4; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}

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