:root {
  color-scheme: light;
  --bg: #f7f0dc;
  --paper: rgba(255, 251, 239, 0.72);
  --paper-strong: rgba(255, 251, 239, 0.92);
  --ink: #191817;
  --muted: #5d584f;
  --dim: #948b7d;
  --line: rgba(25, 24, 23, 0.13);
  --soft-line: rgba(25, 24, 23, 0.07);
  --amber: #9f7417;
  --rust: #9b5034;
  --green: #5d7658;
  --shadow: 0 18px 60px rgba(39, 29, 12, 0.07);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(184, 134, 11, 0.08), transparent 32vw),
    radial-gradient(circle at 82% 18%, rgba(160, 82, 45, 0.07), transparent 34vw),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; }
button, select { font: inherit; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 54px 54px, 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 94%);
}

#app-root {
  width: min(1360px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0 28px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.site-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2vw, 2rem);
  line-height: 1.08;
  text-decoration: none;
  white-space: pre-line;
  letter-spacing: 0.01em;
}

.site-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  display: inline-block;
}
.connection-dot[data-status="online"] { background: var(--green); box-shadow: 0 0 12px rgba(93, 118, 88, 0.55); }
.connection-dot[data-status="offline"] { background: var(--rust); box-shadow: 0 0 12px rgba(155, 80, 52, 0.45); }

.site-footer a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 116, 23, 0.35);
}
.site-footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.art-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 0 18px;
  margin-bottom: 4px;
  background: linear-gradient(to bottom, var(--bg) 72%, rgba(247, 240, 220, 0));
  border-top: 1px solid var(--soft-line);
}

.art-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
}
.art-nav a:hover, .art-nav a:focus-visible, .art-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.page { padding-bottom: 32px; }

.hero-block {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 30px;
  align-items: end;
  min-height: 34vh;
  padding: 50px 0 44px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  color: var(--amber);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 12px;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  margin: 0;
}

.hero-block h1 {
  grid-column: 1;
  white-space: pre-line;
  font-size: clamp(3rem, 8.5vw, 8.4rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  max-width: 920px;
}

.hero-line {
  grid-column: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2vw, 2rem);
  line-height: 1.15;
  color: var(--muted);
  margin: 0 0 16px;
}

.witness-line {
  grid-column: 2;
  color: var(--dim);
  margin: 0 0 24px;
}

.stats-row {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding-top: 24px;
}
.stats-row div {
  border-top: 1px solid var(--soft-line);
  padding-top: 10px;
}
.stats-row b {
  display: block;
  font-family: "Fira Code", "JetBrains Mono", ui-monospace, monospace;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}
.stats-row span {
  display: block;
  color: var(--dim);
  font-size: 0.75rem;
  margin-top: 2px;
}

.portrait-grid,
.detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.triple-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.art-card,
.trace-card,
.question-card,
.dream-card,
.artifact-card,
.world-place,
.hypothesis-card,
.contradiction-card {
  background: var(--paper);
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.art-card h2 {
  color: var(--dim);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.span-2 { grid-column: span 2; }

.focus-card .trace-card,
.art-card .trace-card,
.art-card .question-card,
.art-card .dream-card,
.art-card .artifact-card,
.art-card .world-place,
.art-card .hypothesis-card,
.art-card .contradiction-card {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.lead-text {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  font-size: clamp(1.15rem, 1.8vw, 2rem);
  line-height: 1.2;
  margin: 0;
}

.trace-card h3,
.question-card h3,
.artifact-card h3,
.world-place h3,
.hypothesis-card h3,
.contradiction-card h3 {
  font-size: clamp(1.05rem, 1.35vw, 1.45rem);
  line-height: 1.15;
  margin-bottom: 10px;
}

.trace-card p,
.question-card p,
.dream-card p,
.artifact-card p,
.world-place p,
.hypothesis-card p,
.contradiction-card p,
.art-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.trace-card:not(.compact) > p:first-of-type,
.question-card > p:first-child,
.hypothesis-card > p:first-child,
.contradiction-card > p:first-child,
.dream-text {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.45vw, 1.6rem);
  line-height: 1.24;
}

.trace-card.compact {
  padding: 15px 0;
  border-radius: 0;
  border-width: 1px 0 0;
  box-shadow: none;
  background: transparent;
}

.trace-meta,
.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.meta-line {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
}

.secondary {
  color: var(--dim) !important;
  font-size: 0.92rem;
}

.empty {
  color: var(--dim);
  font-style: italic;
}

.page-heading {
  max-width: 900px;
  padding: 36px 0 24px;
}
.page-heading h1 {
  font-size: clamp(2.6rem, 6vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 18px;
}
.page-heading p:not(.kicker) {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 760px;
}

.list-stack {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.artifact-grid,
.world-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.text-link,
.back-link {
  display: inline-block;
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 116, 23, 0.35);
  margin-top: 8px;
}
.text-link:hover,
.back-link:hover { color: var(--ink); border-bottom-color: var(--ink); }

.back-link { margin: 26px 0 0; }

.field-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}
.field-list li {
  border-top: 1px solid var(--soft-line);
  padding-top: 9px;
  color: var(--muted);
}

.state-list { display: grid; gap: 7px; }
.state-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 7px;
  color: var(--muted);
}
.state-row b {
  font-family: "Fira Code", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  color: var(--ink);
}

.artifact-preview {
  white-space: pre-wrap;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.5;
}

.world-node { border-top: 1px solid var(--soft-line); padding-top: 10px; }
.world-place ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }

.statement-page { max-width: 980px; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.calendar-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--ink);
}
.calendar-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.legend-dot.high { background: var(--amber); }
.legend-dot.medium { background: rgba(159, 116, 23, 0.45); }
.legend-dot.low { background: rgba(159, 116, 23, 0.18); }
.legend-dot.sleep { background: var(--green); border-radius: 50%; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 4px;
  margin-bottom: 20px;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--soft-line);
  font-size: 0.7rem;
  transition: background 0.15s;
}
.calendar-day.high { background: rgba(159, 116, 23, 0.18); border-color: rgba(159, 116, 23, 0.25); }
.calendar-day.medium { background: rgba(159, 116, 23, 0.1); }
.calendar-day.low { background: rgba(159, 116, 23, 0.04); }
.calendar-day.sleep { box-shadow: inset 0 -3px 0 var(--green); }
.calendar-day.artifacts { position: relative; }
.calendar-day.artifacts::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rust);
}
.day-number {
  font-family: "Fira Code", "JetBrains Mono", ui-monospace, monospace;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 500;
}
.day-traces {
  color: var(--dim);
  font-size: 0.62rem;
}
.day-artifacts {
  color: var(--rust);
  font-size: 0.58rem;
}

.calendar-summary {
  max-width: 360px;
  display: grid;
  gap: 7px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--dim);
  font-size: 0.76rem;
  margin-top: 32px;
}

.about-button, #about-modal { display: none; }

.noscript-notice {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
  color: var(--muted);
  font-size: 1rem;
  padding: 24px;
  text-align: center;
}

@media (max-width: 920px) {
  #app-root { width: min(100vw - 28px, 720px); padding-top: 16px; }
  .site-header { align-items: flex-start; }
  .site-tools { flex-wrap: wrap; justify-content: flex-end; }
  .art-nav { position: static; }
  .hero-block { grid-template-columns: 1fr; min-height: auto; padding: 28px 0 30px; }
  .hero-block h1, .hero-line, .witness-line, .stats-row { grid-column: 1; }
  .stats-row, .portrait-grid, .detail-layout, .triple-grid, .artifact-grid, .world-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 540px) {
  .site-header { flex-direction: column; }
  .site-tools { justify-content: flex-start; }
  .hero-block h1 { font-size: clamp(2.6rem, 16vw, 5rem); }
  .page-heading h1 { font-size: clamp(2.2rem, 13vw, 4rem); }
  .art-card, .trace-card, .question-card, .dream-card, .artifact-card, .world-place, .hypothesis-card, .contradiction-card { padding: 17px; border-radius: 14px; }
}
