/* ---------------------------------------------------------------
   Last First Words — Web
   Single-page, Literary Journal light palette (iOS hour-11 keyframe)
--------------------------------------------------------------- */

:root {
  --bg: #FAFAF7;
  --fg: #2A2A2A;
  --secondary: #999999;
  --divider: #E8E6E0;
  --accent: #C9943A;        /* Ink & Marker gold */
  --accent-soft: rgba(201, 148, 58, 0.12);
  --tick: rgba(42, 42, 42, 0.35);
  --serif: "Hedvig Letters Serif", "Iowan Old Style", "Georgia", serif;
  --sans: "Rethink Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

main#app {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------------------------------------------------------
   Header — brand, intro, inline source links
--------------------------------------------------------------- */

.page-header {
  text-align: center;
}

.brand-title {
  margin: 0 0 18px;
  line-height: 1;
  display: flex;
  justify-content: center;
}

.brand-logo {
  display: block;
  width: clamp(200px, 36vw, 300px);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.intro {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
  color: var(--fg);
  max-width: 560px;
  margin: 0 auto 22px;
}

.source-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.source-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 2px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.source-link:hover,
.source-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.source-link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sep {
  color: var(--divider);
  font-size: 14px;
  user-select: none;
}

.reader-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--secondary);
  margin: 0;
  letter-spacing: 0.01em;
  min-height: 20px;
}

/* ---------------------------------------------------------------
   Reader stage — centered word with T-anchor guides
--------------------------------------------------------------- */

.reader-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 20px 0;
  overflow: hidden;
}

.stage-guides {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.stage-guide {
  width: 28px;
  height: 14px;
  position: relative;
}

.stage-guide::before,
.stage-guide::after {
  content: "";
  position: absolute;
  background: var(--accent);
  opacity: 0.9;
  border-radius: 2px;
}

.stage-guide::before { /* horizontal cap */
  left: 0;
  right: 0;
  height: 2px;
}

.stage-guide::after { /* vertical stem */
  left: 50%;
  width: 2px;
  height: 8px;
  transform: translateX(-50%);
}

.stage-guide--top { margin-bottom: 66px; }
.stage-guide--top::before { top: 0; }
.stage-guide--top::after { top: 2px; }

.stage-guide--bottom { margin-top: 66px; }
.stage-guide--bottom::before { bottom: 0; }
.stage-guide--bottom::after { bottom: 2px; }

.word-display {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 54px);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--fg);
  white-space: nowrap;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(var(--word-offset, 0px), -50%);
}

.word-display .word-anchor {
  color: var(--accent);
}

.progress {
  width: 100%;
  max-width: 520px;
  height: 2px;
  margin: 0 auto 20px;
  background: var(--divider);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 240ms linear;
}

/* ---------------------------------------------------------------
   Speed dial
--------------------------------------------------------------- */

.dial-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 0 auto;
}

.dial {
  width: 184px;
  height: 184px;
  border-radius: 50%;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  outline: none;
}

.dial:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dial:active { cursor: grabbing; }

.dial-ticks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform 0ms;
  opacity: 0.77;
}

.dial-ticks line {
  stroke: var(--tick);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.dial-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.dial-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary);
  opacity: 0.77;
  min-height: 16px;
}

.dial-center {
  position: relative;
  height: 54px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dial-play,
.dial-wpm {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
  color: var(--fg);
}

.dial-play {
  width: 40px;
  height: 40px;
  opacity: 1;
}

.dial-wpm {
  font-family: "SF Pro Rounded", "Rethink Sans", system-ui, sans-serif;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.dial.is-playing .dial-play,
.dial.is-adjusting .dial-play {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
}

.dial.is-playing .dial-wpm,
.dial.is-adjusting .dial-wpm {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.dial-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--secondary);
  opacity: 0.77;
  letter-spacing: 0.04em;
}

.side-btn {
  appearance: none;
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  cursor: pointer;
  transition: background 160ms var(--ease), transform 160ms var(--ease), color 160ms var(--ease);
}

.side-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.side-btn:active { transform: scale(0.85); }

.side-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---------------------------------------------------------------
   Footer — support link
--------------------------------------------------------------- */

.page-footer {
  margin-top: 28px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.footer-dot {
  color: var(--divider);
  font-size: 12px;
  user-select: none;
}

.support-link {
  color: var(--secondary);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.support-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------
   Responsive
--------------------------------------------------------------- */

@media (max-width: 520px) {
  main#app { padding: 32px 20px 24px; }
  .source-links { gap: 6px; }
  .sep { font-size: 12px; }
  .dial-wrap { gap: 14px; }
  .dial { width: 172px; height: 172px; }
}

/* ---------------------------------------------------------------
   Privacy page
--------------------------------------------------------------- */

.policy {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 56px;
  color: var(--fg);
}

.policy-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 24px;
}

.policy-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px 6px 6px;
  border-radius: 8px;
  margin-left: -6px;
  margin-bottom: 18px;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}

.policy-back:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.policy-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 4vw, 38px);
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  line-height: 1.15;
}

.policy-meta {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 18px;
}

.policy-intro {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  margin: 0;
  max-width: 58ch;
}

.policy-section {
  padding: 20px 0 4px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 20px;
}

.policy-section:last-of-type {
  border-bottom: none;
}

.policy-section h2 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  margin: 0 0 16px;
}

.policy-section h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.005em;
  color: var(--fg);
  margin: 18px 0 6px;
}

.policy-section h3:first-of-type {
  margin-top: 0;
}

.policy-section p {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--fg);
  margin: 0 0 14px;
  max-width: 62ch;
}

.policy-section p a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 160ms var(--ease);
}

.policy-section p a:hover {
  color: var(--accent);
}

.policy-footer {
  margin-top: 36px;
}

@media (max-width: 520px) {
  .policy { padding: 28px 20px 44px; }
  .policy-section p { font-size: 14px; }
}

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