/* HooLang website. It borrows the app's reader: porcelain paper, graphite ink, one serif, and brass only on
   the things you can pick. */
@font-face {
  font-family: Literata;
  src: url("literata.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --paper: #f3f2ef;
  --sheet: #fffefb;
  --ink: #1a1815;
  --stone: #6a655c;
  --rule: #dedbd3;
  --brass: #8a621e;
  --brass-tint: #f1e3c2;
  --lift: 0 1px 0 rgba(26, 24, 21, 0.04), 0 18px 40px -22px rgba(58, 42, 12, 0.35);
  --serif: Literata, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121110;
    --sheet: #1c1b19;
    --ink: #f1eee8;
    --stone: #a9a398;
    --rule: #34312c;
    --brass: #e2b969;
    --brass-tint: #3a3222;
    --lift: 0 18px 40px -22px rgba(0, 0, 0, 0.8);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--serif);
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums;
}

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 4px; }

.top, main, footer { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  font-weight: 650;
  font-size: 1.3125rem;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.brand img { border-radius: 9px; }

nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; font-size: 1rem; }
nav a { color: var(--stone); text-decoration: none; }
nav a:hover { color: var(--ink); text-decoration: underline; }

h1, h2, h3, dt { font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
p, dd { text-wrap: pretty; }
p { margin: 0 0 1rem; }

/* Landing: the headline on the left, a page from the reader on the right */
.hero {
  display: grid;
  gap: 2.5rem;
  align-items: start;
  padding-block: clamp(1.5rem, 6vw, 4.5rem) 2rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 8.5vw, 4.25rem);
  font-weight: 560;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 1.5rem;
}
.lead { font-size: 1.25rem; line-height: 1.55; max-width: 30rem; }
.hint { color: var(--stone); font-style: italic; max-width: 30rem; }

.sheet {
  position: relative;
  margin: 0;
  padding: clamp(1.5rem, 5vw, 2.75rem) clamp(1.25rem, 5vw, 2.75rem) 2rem;
  background: var(--sheet);
  border-radius: 6px 22px 22px 6px;
  box-shadow: var(--lift);
}
.sheet-title { font-size: 1.0625rem; font-style: italic; color: var(--stone); margin-bottom: 1.25rem; }
.sheet-text { font-size: clamp(1.375rem, 4.4vw, 1.75rem); line-height: 1.62; margin: 0 0 1.5rem; }

.word {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0 0.08em;
  margin: 0 -0.08em;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  transition: background-color 140ms ease;
}
.word:hover { background: color-mix(in srgb, var(--brass-tint) 50%, transparent); }
.word[aria-pressed="true"] { background: var(--brass-tint); text-decoration-color: transparent; }

/* The translation: below the text without scripts, right under the chosen word with them */
.gloss {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.1rem 0.75rem;
  width: min(100%, 17rem);
  padding: 0.9rem 1.1rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
}
.gloss-word { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.gloss-ipa { font-size: 0.9375rem; opacity: 0.7; font-family: "Charis SIL", "Gentium Plus", var(--serif); }
.gloss-meaning { grid-column: 1 / -1; font-size: 1.375rem; color: color-mix(in srgb, var(--brass-tint) 70%, var(--paper)); }

.anchored { padding-bottom: 7.5rem; }
.anchored .sheet-text { margin-bottom: 0; }
.anchored .gloss {
  position: absolute;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.55);
  transition: left 220ms cubic-bezier(0.2, 0.8, 0.2, 1), top 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.anchored .gloss::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(var(--tip, 50%) - 7px);
  width: 14px;
  height: 14px;
  background: var(--ink);
  border-radius: 3px;
  transform: rotate(45deg);
  transition: left 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.anchored .gloss.above::before { top: auto; bottom: -6px; }

/* What the app does, set like dictionary entries: the headword, then its explanation */
.entries { margin: clamp(2rem, 7vw, 4.5rem) 0 0; border-top: 1px solid var(--rule); }
.entries > div { display: grid; gap: 0.25rem 2.5rem; padding-block: 1.5rem; border-bottom: 1px solid var(--rule); }
.entries dt { font-size: 1.375rem; line-height: 1.25; }
.entries dd { margin: 0; max-width: 38rem; }
.closing { margin-top: 2rem; color: var(--stone); max-width: 38rem; }

/* Policy and support: one reading column */
.prose { max-width: 40rem; padding-block: clamp(1rem, 4vw, 2.5rem) 1rem; }
.prose h1 { font-size: clamp(2rem, 6.5vw, 3rem); font-weight: 560; line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 1rem; }
.prose h2 { font-size: 1.5rem; line-height: 1.25; margin: 2.75rem 0 0.75rem; }
.prose h3 { font-size: 1.1875rem; line-height: 1.35; margin: 1.75rem 0 0.35rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--brass); }
.switch { font-style: italic; }

footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--stone);
  font-size: 1rem;
}
footer p { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; margin: 0; }

@media (min-width: 56rem) {
  .hero { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr); gap: 4rem; }
  .hero-copy { padding-top: 1.5rem; }
  .entries > div { grid-template-columns: 17rem 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .word, .anchored .gloss, .anchored .gloss::before { transition: none; }
}
