/* =============================================================
   Shared styles for index.html + philosophy.html + future pages
   ============================================================= */

:root {
  --bg: #efe6d2;
  --ink: #1a1a1a;
  --accent: #c1440e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body {
  /* Single fluid scale used by both the h1 font-size and the notebook grid
     cell size — so the grid always matches the height of the upper line.

     clamp(MIN, IDEAL, MAX) tuned so:
       - 400px viewport → ~45px (mobile: text almost full-width)
       - 1280px+        → 96px  (desktop max)
     The IDEAL component is calc(<base rem> + <vw>) which linearly
     interpolates between the two endpoints, hitting both exactly.
  */
  --fluid-size: clamp(2.8rem, calc(1.4rem + 5.8vw), 6rem);
  --grid-cell: var(--fluid-size);
  --grid-ink: rgba(60, 40, 20, 0.07);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-ink) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-ink) 1px, transparent 1px);
  background-size: var(--grid-cell) var(--grid-cell);
}

main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

h1 {
  font-weight: 300;
  font-size: var(--fluid-size);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: none;
  text-align: center;
}

.byline {
  font-family: "Fraunces", serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1;
  color: rgba(60, 40, 20, 0.42);
  letter-spacing: 0.02em;
  margin: 0;
  text-align: center;
  will-change: transform;
}

.byline a {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 180ms ease;
}

.byline a:hover {
  color: rgba(60, 40, 20, 0.75);
}

/* ───────────── Liquid-glass dock (Apple-inspired) ───────────── */

.dock {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.32) 100%
  );
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);

  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 -1px 0 rgba(255, 255, 255, 0.15) inset,
    0 18px 40px -12px rgba(40, 30, 15, 0.20),
    0 4px 12px -6px rgba(40, 30, 15, 0.12);
  z-index: 50;
}

.tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(40, 30, 15, 0.72);
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  transition: color 220ms ease, background 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover {
  color: rgba(40, 30, 15, 0.92);
}

.tab[aria-current="page"] {
  color: rgba(40, 30, 15, 1);
  background: rgba(40, 30, 15, 0.07);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  box-shadow:
    0 0 0 0.5px rgba(40, 30, 15, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 6px 18px -4px rgba(40, 30, 15, 0.22),
    0 1px 3px rgba(40, 30, 15, 0.08);
}

.tab:focus-visible {
  outline: 2px solid rgba(193, 68, 14, 0.55);
  outline-offset: 2px;
}

/* ───────────── Home-only rotator (animated handwritten word) ───────────── */

.rotator {
  display: block;
  color: var(--accent);
  min-width: 4em;
  text-align: center;
  margin-top: -1.2em;
}

.rotator svg {
  height: 3em;
  width: auto;
  overflow: visible;
  vertical-align: middle;
}

.letter {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

.letter.in {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 700ms cubic-bezier(.4,.05,.5,1);
}

.letter.out {
  opacity: 0;
  transition: opacity 500ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .letter {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    transition: none !important;
  }
}
