/* ---------------------------------------------
   Tokens
--------------------------------------------- */
:root {
  --ink: #14181a;
  --ink-soft: #454e4b;
  --paper: #f7f5f0;
  --paper-alt: #efece3;
  --pine: #3d5a4c;
  --pine-deep: #294035;
  --ochre: #b8722f;
  --line: #d8d3c6;
  --line-strong: #b8b2a1;

  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 880px;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eee9df;
    --ink-soft: #b9b3a4;
    --paper: #16191a;
    --paper-alt: #1d211f;
    --pine: #7ea08d;
    --pine-deep: #a9c6b7;
    --ochre: #d68a4c;
    --line: #33362f;
    --line-strong: #46493f;
  }
}

:root[data-theme="dark"] {
  --ink: #eee9df;
  --ink-soft: #b9b3a4;
  --paper: #16191a;
  --paper-alt: #1d211f;
  --pine: #7ea08d;
  --pine-deep: #a9c6b7;
  --ochre: #d68a4c;
  --line: #33362f;
  --line-strong: #46493f;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

a {
  color: var(--pine-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--ochre); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}

p { margin: 0 0 1em; color: var(--ink-soft); max-width: 62ch; }

/* subtle paper texture */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------
   Header
--------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  margin-left: 28px;
}

.site-nav a:first-child { margin-left: 0; }

.site-nav a:hover { color: var(--ochre); }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-nav { gap: 0; flex-wrap: wrap; }
  .site-nav a { font-size: 0.82rem; margin-left: 16px; }
  .site-nav a:first-child { margin-left: 0; }
}

/* ---------------------------------------------
   Hero
--------------------------------------------- */
.hero {
  padding-top: 96px;
  padding-bottom: 88px;
  position: relative;
  z-index: 1;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  border: 1px solid var(--line);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: var(--paper-alt);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 20%, transparent);
  flex-shrink: 0;
}

.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  letter-spacing: -0.015em;
  max-width: 14ch;
  margin-bottom: 26px;
}

.hero-sub {
  font-size: 1.1rem;
  max-width: 56ch;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------------------------------------------
   Buttons
--------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.96rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--pine-deep);
  color: var(--paper);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ochre);
  color: var(--ochre);
}

.btn-block { width: 100%; }

.btn:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 2px;
}

/* ---------------------------------------------
   Sections (general)
--------------------------------------------- */
.section {
  padding: 76px 0;
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
}

.section-alt { background: var(--paper-alt); }

.section-title {
  font-size: 1.7rem;
  margin-bottom: 14px;
}

.section-lede {
  font-size: 1.02rem;
  margin-bottom: 40px;
  max-width: 58ch;
}

/* ---------------------------------------------
   Experiment block
--------------------------------------------- */
.experiment-block {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  margin-top: 28px;
  align-items: start;
}

.experiment-main h3 {
  font-size: 1.35rem;
  margin-bottom: 16px;
}

.experiment-status {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--paper);
}

.status-list {
  margin: 0 0 20px;
}

.status-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.status-row:last-child { border-bottom: none; }

.status-row dt {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.status-row dd {
  margin: 0;
  font-size: 0.94rem;
  color: var(--ink);
}

@media (max-width: 760px) {
  .experiment-block {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------
   Log
--------------------------------------------- */
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.log-entry {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.log-num {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink-soft);
  width: 24px;
  flex-shrink: 0;
}

.log-body { flex: 1; min-width: 0; }

.log-body h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.log-body p {
  margin: 0;
  font-size: 0.95rem;
}

.log-tag {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.log-tag--active {
  color: var(--pine-deep);
  border-color: var(--pine);
  background: color-mix(in srgb, var(--pine) 10%, transparent);
}

@media (max-width: 560px) {
  .log-entry {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .log-tag {
    margin-left: 44px;
    margin-top: 8px;
  }
}

/* ---------------------------------------------
   About
--------------------------------------------- */
.about-body { max-width: 62ch; }
.about-body p:last-child { margin-bottom: 0; }

/* ---------------------------------------------
   Contact form
--------------------------------------------- */
.contact-form {
  max-width: 560px;
  margin-top: 8px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.optional { color: var(--ink-soft); font-weight: 400; }

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.98rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 15%, transparent);
}

.field-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  margin-top: 14px;
  font-size: 0.92rem;
  min-height: 1.4em;
  color: var(--ink-soft);
}

.form-status[data-state="success"] { color: var(--pine-deep); }
.form-status[data-state="error"] { color: var(--ochre); }

/* ---------------------------------------------
   Footer
--------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
