/* ============================================================
   glottis — personal landing page

   Design: brutalist bones, warm skin. Playful in interaction,
   editorial in stillness. Built for everyone: semantic HTML,
   system fonts, high contrast, no bloat.
   ============================================================ */

/* ----------------------------------------------------------
   Custom properties — light theme (default)
   ---------------------------------------------------------- */
:root {
  --bg: #faf8f5;
  --text: #1a1a1a;
  --text-secondary: #5c5550;
  --accent: #b53a35;
  --border: #d4cfc9;
  --border-strong: #a09890;

  --font-mono: "ui-monospace", "SF Mono", "Menlo", "Monaco", "Consolas",
    "Liberation Mono", "Courier New", monospace;
  --font-serif: "Charter", "Bitstream Charter", "Georgia", "Cambria",
    "Times New Roman", serif;

  --space-xs: 0.375rem;
  --space-sm: 0.75rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  /* Type scale is set directly on elements — these are fallback refs */
}

/* ----------------------------------------------------------
   Dark theme — activated via data attribute or OS preference
   ---------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #1a1817;
  --text: #e8e4e0;
  --text-secondary: #9a9490;
  --accent: #d65a55;
  --border: #3a3532;
  --border-strong: #5c5550;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1817;
    --text: #e8e4e0;
    --text-secondary: #9a9490;
    --accent: #d65a55;
    --border: #3a3532;
    --border-strong: #5c5550;
  }
}

/* ----------------------------------------------------------
   Reset & base
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%; /* 16px baseline; changed by text-size toggle */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: var(--space-md);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Respect motion preference */
@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
}

/* ----------------------------------------------------------
   Skip link — visible on focus, hidden otherwise
   ---------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 100;
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 2px;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ----------------------------------------------------------
   Main content block
   ---------------------------------------------------------- */
main {
  max-width: 36rem;
  width: 100%;
  outline: none; /* we use :focus-visible instead */
}

/* ----------------------------------------------------------
   Name — mono, crimson, large. The anchor of the page.
   ---------------------------------------------------------- */
h1 {
  margin: 0 0 var(--space-lg);
  font-family: var(--font-mono);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ----------------------------------------------------------
   Blurb — serif, set for reading. The heart of the page.
   ---------------------------------------------------------- */
.blurb {
  margin: 0 0 var(--space-lg);
  font-family: var(--font-serif);
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  line-height: 1.7;
  color: var(--text);
  max-width: 32rem;
}

/* ----------------------------------------------------------
   Contact nav — mono, quiet, anchored by underlines
   ---------------------------------------------------------- */
nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.125em 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--border-strong);
  border-radius: 50%;
  margin: 0 var(--space-xs);
}

/* ----------------------------------------------------------
   Page controls — text size & theme toggles
   Fixed bottom-right. Subtle, honest, utilitarian.
   ---------------------------------------------------------- */
.controls {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  display: flex;
  gap: var(--space-xs);
  z-index: 10;
}

.controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.controls button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.controls button:active {
  transform: scale(0.96);
}

/* Size indicator — the smaller/larger "a" in "Aa" */
.size-indicator {
  font-size: 0.7em;
  vertical-align: baseline;
}

/* ----------------------------------------------------------
   Text size variants
   ---------------------------------------------------------- */
[data-text-size="small"] {
  font-size: 87.5%; /* ~14px base */
}

[data-text-size="large"] {
  font-size: 125%; /* ~20px base */
}

/* ----------------------------------------------------------
   Focus ring — global, visible, styled
   ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove default focus for mouse users on main (we handle it) */
main:focus:not(:focus-visible) {
  outline: none;
}

/* ----------------------------------------------------------
   Selection — subtle crimson, editorial feel
   ---------------------------------------------------------- */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ----------------------------------------------------------
   Print — strip everything but the content
   ---------------------------------------------------------- */
@media print {
  .controls,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    padding: 1in;
    min-height: auto;
    display: block;
  }

  h1 {
    color: #000;
  }
}
