@font-face {
  font-family: 'Geist Serif';
  src: url('/fonts/GeistSerif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: oklch(0.975 0.006 85);
  --ink: oklch(0.23 0.01 85);
  --muted: oklch(0.52 0.01 85);
  --line: oklch(0.23 0.01 85 / 0.12);

  /* Polypropylene dividers: soft pastels, see-through. */
  --pink: oklch(0.86 0.06 5);
  --blue: oklch(0.85 0.055 240);
  --lilac: oklch(0.85 0.055 300);
  --lime: oklch(0.91 0.09 115);
  --teal: oklch(0.87 0.06 190);
  --peach: oklch(0.88 0.065 60);

  /* Text on a divider is always dark: the pastels are light in both themes. */
  --sheet-ink: oklch(0.23 0.01 85);
  --sheet-muted: oklch(0.23 0.01 85 / 0.62);

  --tab-w: 30px;
  --tab-h: clamp(76px, 15vh, 124px);
  --tab-gap: 6px;
  --sheet-w: min(540px, calc(100vw - var(--tab-w) - 14px));
  --peek: 7px;

  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --t-sheet: 420ms;

  --serif: 'Geist Serif', ui-serif, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: oklch(0.17 0.004 85);
    --ink: oklch(0.94 0.005 85);
    --muted: oklch(0.68 0.008 85);
    --line: oklch(0.94 0.005 85 / 0.14);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: oklch(0.17 0.004 85);
  --ink: oklch(0.94 0.005 85);
  --muted: oklch(0.68 0.008 85);
  --line: oklch(0.94 0.005 85 / 0.14);
  color-scheme: dark;
}

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* One page. No scroll on either axis. */
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--lime);
  color: var(--sheet-ink);
}

/* Language: both are in the HTML, CSS shows one. */
html[data-lang='en'] [data-l='es'],
html[data-lang='es'] [data-l='en'] {
  display: none;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklch, currentColor 35%, transparent);
  transition: text-decoration-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration-color: currentColor;
  }
}

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

/* ---------- Center ---------- */

.center {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px calc(var(--tab-w) + 20px);
  text-align: center;
}

.name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6.4vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.role {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.tagline {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 22px);
  text-wrap: balance;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.lang {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.04em;
  padding: 7px 11px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.lang button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
.lang button:active {
  transform: scale(0.96);
}

/* ---------- Scrim ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: oklch(0.2 0.01 85 / 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}
html[data-open] .scrim {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Sheets (the dividers) ---------- */

.sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 20;
  width: var(--sheet-w);
  color: var(--sheet-ink);
  background: color-mix(in oklch, var(--c) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  transition: transform var(--t-sheet) var(--ease-drawer), visibility 0s linear var(--t-sheet);
  visibility: hidden;
}
.sheet[data-side='left'] {
  left: 0;
  transform: translateX(-100%);
  box-shadow: 1px 0 0 oklch(0.23 0.01 85 / 0.08);
}
.sheet[data-side='right'] {
  right: 0;
  transform: translateX(100%);
  box-shadow: -1px 0 0 oklch(0.23 0.01 85 / 0.08);
}

/* Hover on a tab: its divider edge peeks out with it. */
.sheet.peek,
.sheet.open {
  visibility: visible;
  transition: transform var(--t-sheet) var(--ease-drawer), visibility 0s;
}
.sheet[data-side='left'].peek {
  transform: translateX(calc(-100% + var(--peek)));
  transition-duration: 220ms;
}
.sheet[data-side='right'].peek {
  transform: translateX(calc(100% - var(--peek)));
  transition-duration: 220ms;
}
.sheet.open {
  z-index: 21;
  transform: translateX(0) !important;
}

.sheet-body {
  height: 100%;
  overflow-y: auto; /* Safety net on very short screens only. */
  overscroll-behavior: contain;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 44px;
}
.sheet-body::-webkit-scrollbar {
  display: none;
}

.sheet h2 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  outline: none;
}

.lead {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.4;
  text-wrap: pretty;
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rows li {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid oklch(0.23 0.01 85 / 0.12);
}
.rows li:last-child {
  border-bottom: 1px solid oklch(0.23 0.01 85 / 0.12);
}
.rows .k {
  color: var(--sheet-muted);
  font-size: 13px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.rows h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 550;
}
.rows p {
  margin: 0;
  text-wrap: pretty;
}
.rows h3 + p {
  margin-top: 2px;
}
.rows p + p {
  margin-top: 6px;
}
.meta {
  margin-top: 4px !important;
  color: var(--sheet-muted);
  font-size: 13px;
}

/* Placeholders Juan still has to fill. Easy to spot, easy to grep. */
.todo {
  text-decoration: underline dashed oklch(0.23 0.01 85 / 0.45);
  text-underline-offset: 3px;
}

/* ---------- Tabs ---------- */

.rail {
  position: fixed;
  top: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: var(--tab-gap);
  translate: 0 -50%;
  transition: transform var(--t-sheet) var(--ease-drawer);
}
.rail-left {
  left: 0;
  margin-top: calc(var(--tab-h) * -0.35); /* Stagger: the two edges don't mirror. */
}
.rail-right {
  right: 0;
  margin-top: calc(var(--tab-h) * 0.35);
}
html[data-open='left'] .rail-left {
  transform: translateX(var(--sheet-w));
}
html[data-open='right'] .rail-right {
  transform: translateX(calc(var(--sheet-w) * -1));
}

.tab {
  position: relative;
  appearance: none;
  border: 0;
  width: var(--tab-w);
  height: var(--tab-h);
  padding: 0;
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--c) 78%, transparent);
  color: var(--sheet-ink);
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.02em;
  writing-mode: vertical-rl;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 220ms var(--ease-drawer), background-color 160ms ease;
}
.rail-left .tab {
  border-radius: 0 8px 8px 0;
}
.rail-left .tab > span {
  transform: rotate(180deg); /* Read bottom to top on the left edge. */
}
.rail-right .tab {
  border-radius: 8px 0 0 8px;
}

.tab[aria-expanded='true'] {
  background: color-mix(in oklch, var(--c) 86%, transparent);
}

/* The hit area reaches past the tab, so a fast cursor still lands on it. */
.tab::after {
  content: '';
  position: absolute;
  inset: calc(var(--tab-gap) / -2) -8px;
}

@media (hover: hover) and (pointer: fine) {
  .rail-left .tab:hover {
    transform: translateX(var(--peek));
  }
  .rail-right .tab:hover {
    transform: translateX(calc(var(--peek) * -1));
  }
  .tab[aria-expanded='true']:hover {
    transform: none;
  }
}

.tab:active {
  transition-duration: 120ms;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  :root {
    --tab-w: 26px;
    --tab-h: clamp(70px, 13vh, 104px);
  }
  .sheet-body {
    padding: max(32px, env(safe-area-inset-top)) 22px 24px;
    font-size: 14px;
  }
  /* The open sheet leaves no room for the other edge's tabs. */
  html[data-open='left'] .rail-right,
  html[data-open='right'] .rail-left {
    opacity: 0;
    pointer-events: none;
  }
  .rail {
    transition: transform var(--t-sheet) var(--ease-drawer), opacity 160ms ease;
  }
  .sheet h2 {
    font-size: 28px;
    margin-bottom: 16px;
  }
  .lead {
    font-size: 17px;
    margin-bottom: 18px;
  }
  .rows li {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 9px 0;
  }
  .rows .k,
  .meta {
    font-size: 12px;
  }
  .tab {
    font-size: 11px;
  }
}

/* Short phones (iPhone SE): drop the stack and place lines to fit. */
@media (max-width: 640px) and (max-height: 700px) {
  .meta {
    display: none;
  }
}

/* Short desktop screens: tighten so every sheet still fits. */
@media (max-height: 820px) and (min-width: 641px) {
  .sheet-body {
    font-size: 14px;
    padding-block: 24px;
  }
  .sheet h2 {
    font-size: 30px;
    margin-bottom: 14px;
  }
  .rows li {
    padding: 9px 0;
  }
}

@media (max-height: 560px) {
  .sheet-body {
    justify-content: flex-start;
  }
  .tagline,
  .links {
    margin-top: 18px;
  }
}

/* ---------- Reduced motion: keep fades, drop slides ---------- */

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-sheet: 0ms;
  }
  .sheet {
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    opacity: 0;
  }
  .sheet.open {
    opacity: 1;
    transition: opacity 180ms ease, visibility 0s;
  }
  .sheet.peek:not(.open) {
    opacity: 1;
  }
  .tab {
    transition: background-color 160ms ease;
  }
}

/* ---------- Print: every divider, one after another ---------- */

@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: #fff;
    color: #000;
  }
  .center,
  .sheet {
    position: static;
    transform: none !important;
    visibility: visible;
    width: auto;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  .center {
    padding: 0 0 16px;
    align-items: flex-start;
    text-align: left;
  }
  .foot,
  .rail,
  .scrim {
    display: none;
  }
  .sheet-body {
    height: auto;
    overflow: visible;
    padding: 12px 0;
  }
  .sheet {
    break-inside: avoid;
  }
}
