/* The Reverist — site styles */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Night is the default; day applies when the visitor's clock says so or they choose it. */
:root {
  --bg: #000000;
  --ink: #F4EDE1;
  --muted: #8E8A82;
  --gold: #E3A857;
  --rule: rgba(244, 237, 225, 0.16);
  --focus: #E3A857;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Futura", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="day"] {
  --bg: #FFFFFF;
  --ink: #000000;
  --muted: #6B6B6B;
  --rule: rgba(0, 0, 0, 0.12);
  --focus: #000000;
  color-scheme: light;
}

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

html {
  background: var(--bg);
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background-color 0.6s ease, color 0.6s ease;
}

a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--gold); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 2px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--bg); padding: 0.5rem 1rem; z-index: 10;
}
.skip:focus { top: calc(1rem + env(safe-area-inset-top, 0px)); }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.brand i { display: inline-flex; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--muted); transition: color 0.2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.mode { color: var(--muted); font-size: 0.95rem; transition: color 0.2s; }
.mode:hover { color: var(--ink); }

/* ---------- Home: one line, full screen ---------- */
.home {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem clamp(1.25rem, 6vw, 4rem) 3rem;
}
.line {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.4vw, 4.6rem);
  line-height: 1.16;
  max-width: 17em;
  text-wrap: balance;
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.line.is-leaving { opacity: 0; transform: translateY(-0.15em); }
.line.is-arriving { opacity: 0; transform: translateY(0.15em); transition: none; }
.divider {
  width: 64px;
  height: 2px;
  background: var(--gold);
  margin: 2.5rem 0 0;
  border: 0;
}
.credit {
  margin: 1.75rem 0 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding-left: 0.32em; /* balances the tracking so the name stays centred */
}
.credit[hidden] { display: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 2rem;
  font-size: 0.95rem;
}
.actions .mood-link { color: var(--muted); text-decoration: none; }
.actions .mood-link:hover { color: var(--ink); }
.actions .do { display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem; }
.actions button { color: var(--muted); transition: color 0.2s; }
.actions button:hover { color: var(--ink); }
.actions .primary { color: var(--ink); }
.actions .primary::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 0.2rem;
  background: var(--gold);
}
.status {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.status.is-visible { opacity: 1; }

/* ---------- Reading pages ---------- */
.page {
  max-width: 54rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 5vw, 3rem) 6rem;
}
.page h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 1rem;
}
.lede { color: var(--muted); margin: 0 0 3rem; max-width: 36rem; }

/* Archive */
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.moods { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.moods button { color: var(--muted); font-size: 0.95rem; padding: 0.15rem 0; border-bottom: 1px solid transparent; }
.moods button:hover { color: var(--ink); }
.moods button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.search {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0.35rem 0;
  min-width: 14rem;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: none; border-bottom-color: var(--gold); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--rule); }
.list a {
  display: block;
  padding: 2rem 0;
  text-decoration: none;
}
.list .text {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  line-height: 1.22;
  max-width: 30em;
  transition: color 0.2s;
}
.list a:hover .text { color: var(--gold); }
:root[data-theme="day"] .list a:hover .text { color: var(--muted); }
.list .meta { display: block; margin-top: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.empty { padding: 3rem 0; color: var(--muted); }
.count { color: var(--muted); font-size: 0.9rem; margin: 1.5rem 0 0; }

/* About */
.define {
  margin: 0 0 3.5rem;
  padding: 0;
}
.define .word {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1;
}
.define .sense { color: var(--muted); margin-top: 0.75rem; font-size: 1.05rem; }
.prose { max-width: 36rem; }
.prose p { margin: 0 0 1.25rem; }
.prose h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 3rem 0 0.75rem;
}

.foot {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 3rem) 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 560px) {
  .brand span { display: none; }
  .actions { justify-content: center; }
  .actions .mood-link { order: 2; }
  .search { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
