/* ─── Fonts ─── */

@font-face {
  font-family: 'Work Sans';
  src: url('../fonts/WorkSans-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('../fonts/WorkSans-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ─── Theme ─── */

:root {
  --bg: #100f0e;
  --ink: #ffffff;
  --ink-dim: #8a857c;
  --ink-faint: #4a463f;
  --rule: #26241f;
  --accent: #d4a857;
  --status: #6fcf6a;
  --status-glow: rgba(111, 207, 106, 0.5);
  --grain: 0.035;
}

:root[data-theme="light"] {
  --bg: #f5f1e8;
  --ink: #1a1815;
  --ink-dim: #6b6558;
  --ink-faint: #b8b1a0;
  --rule: #d9d2bf;
  --accent: #8a5a1a;
  --status: #2f8a2a;
  --status-glow: rgba(47, 138, 42, 0.5);
  --grain: 0.025;
}

/* ─── Base ─── */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Work Sans', system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 400ms ease, color 400ms ease;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--bg); }

/* Subtle film grain over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.serif {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-feature-settings: "ss01" on, "ss02" on;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  letter-spacing: -0.01em;
}

/* ─── Layout ─── */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 64px 32px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 120px;
}

.content {
  padding-bottom: 24px;
  max-width: 620px;
}

/* ─── Left rail ─── */

/* .rail is fixed, so .rail-slot holds its place in the grid. */
.rail-slot { position: relative; }

.rail {
  position: fixed;
  top: 48px;
  width: 180px;
  height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rail-top { display: flex; flex-direction: column; gap: 14px; }

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-dim);
}

.nav-link {
  font-size: 14px;
  color: var(--ink-dim);
  transition: color 200ms ease, transform 200ms ease;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover,
.nav-link.active { color: var(--ink); }

.nav-link .arrow {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
  font-size: 11px;
}
.nav-link:hover .arrow { opacity: 1; transform: translateX(0); }

.signature {
  margin-top: 40px;
  width: 175px;
  opacity: 0.9;
}
.signature img {
  width: 100%;
  height: auto;
  display: block;
  filter: invert(1);
}
:root[data-theme="light"] .signature img { filter: none; }

/* ─── Location + status ─── */

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.meta-row .label { color: var(--ink); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status);
  animation: pulse 2.4s ease-out infinite;
  margin-left: auto;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--status-glow); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ─── Theme toggle ─── */

.theme-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  color: var(--ink-dim);
  transition: color 200ms ease;
  width: 100%;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .label { color: var(--ink); }

.theme-toggle svg {
  width: 14px;
  height: 14px;
  margin-left: auto;
  transition: transform 400ms ease;
}
.theme-toggle:hover svg { transform: rotate(20deg); }

/* ─── Name ─── */

.name {
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 40px;
}

/* ─── Content blocks ─── */

/* Serif throughout, matching the reference: statement line, then
   em-dash detail lines beneath it. */
.blocks {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-size: 15px;
  line-height: 1.5;
}

.block { margin-bottom: 30px; }
.block:last-child { margin-bottom: 0; }

.block p {
  margin: 0 0 14px;
  color: var(--ink);
}

.block ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.block li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  color: var(--ink);
}
.block li:last-child { margin-bottom: 0; }

.block li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink);
}

.inline-link {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 200ms ease;
}
.inline-link:hover { color: var(--accent); }

/* ─── Footer ─── */

.footer {
  margin-top: 48px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-faint);
}
.footer .links { display: flex; gap: 18px; }
.footer a { color: var(--ink-dim); transition: color 200ms ease; }
.footer a:hover { color: var(--ink); }

/* Location + theme strip, shown only on mobile (see media query). */
.mobile-meta { display: none; }

/* ─── Entrance animation ─── */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 700ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .status-dot { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ─── Mobile ─── */

@media (max-width: 760px) {
  .page {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 28px 22px;
  }

  .rail-slot,
  .rail { display: none; }

  .content { max-width: 100%; padding-bottom: 0; }

  .name { font-size: 26px; margin-bottom: 32px; }

  /* Footer is the single grounding strip on mobile:
     links row, then place + clock + theme row. */
  .footer {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-top: 32px;
    padding-top: 16px;
  }
  .footer .links { order: 1; gap: 22px; }
  .footer .copyright { order: 2; }

  .mobile-meta {
    order: 3;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
    font-size: 12px;
    color: var(--ink-dim);
  }
  .mobile-meta .label { color: var(--ink); }
  .mobile-meta .status-dot {
    width: 6px;
    height: 6px;
    margin-left: 0;
  }
  .mobile-meta .spacer { flex: 1; }

  .mobile-meta .theme-toggle {
    width: auto;
    gap: 8px;
    font-size: 12px;
  }
  .mobile-meta .theme-toggle svg {
    width: 13px;
    height: 13px;
    margin-left: 0;
  }
}
