/* ================================================================
   AQUAMESH — holding page
   warm charcoal / bone monochrome / one quiet scene
   ================================================================ */

:root {
  /* night water (default) */
  --bg: #0d0d0e;
  --bg-rgb: 13, 13, 14;
  --ink: #e8e6e1;
  --ink-rgb: 232, 230, 225;
  --ink-dim: #7d7c77;
  --accent: #8ab8af; /* sea glass — the one colour, meaning: alive */
  --accent-rgb: 138, 184, 175;
  --hairline: rgba(var(--ink-rgb), 0.16);
  --breath: rgba(var(--accent-rgb), 0.05);

  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --pad: clamp(22px, 3.4vw, 48px);
}

/* paper water */
:root[data-theme="light"] {
  --bg: #eceae4;
  --bg-rgb: 236, 234, 228;
  --ink: #1b1c1c;
  --ink-rgb: 27, 28, 28;
  --ink-dim: #6f6d66;
  --accent: #4d8077; /* deepened for contrast on paper */
  --accent-rgb: 77, 128, 119;
  --breath: rgba(var(--accent-rgb), 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.6s ease, color 0.6s ease;
}

html { transition: background-color 0.6s ease; }

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }

/* ----------------------------------------------------------------
   Fixed layers
---------------------------------------------------------------- */

#stage { position: fixed; inset: 0; z-index: 0; }
#stage canvas { display: block; }

/* Soft atmosphere: faint horizon breath, melt at top and bottom */
.haze {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(58% 24% at 50% 60%, var(--breath) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, transparent 26%),
    linear-gradient(0deg, var(--bg) 0%, transparent 30%);
  transition: background 0.6s ease;
}

.grain {
  position: fixed;
  inset: -100px;
  z-index: 40;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ----------------------------------------------------------------
   Corners — four whispers framing the page
---------------------------------------------------------------- */

.corner {
  position: fixed;
  z-index: 10;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  opacity: 0; /* revealed by intro */
}

.corner--tr {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  transition: color 0.3s ease;
}

.theme-toggle:empty { display: none; } /* no js, no dead control */

.theme-toggle__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  transition: background-color 0.3s ease;
}

/* in the light, the dot is filled — the label says DARK, the dot shows it */
:root[data-theme="light"] .theme-toggle__dot { background: currentColor; }

.theme-toggle:hover { color: var(--accent); }

.corner--tl { top: var(--pad); left: var(--pad); color: var(--ink); }
.corner--tl sup { font-size: 6px; letter-spacing: 0; margin-left: 2px; color: var(--accent); }
.corner--tr { top: var(--pad); right: var(--pad); font-variant-numeric: tabular-nums; }
.corner--bl { bottom: var(--pad); left: var(--pad); }
.corner--br { bottom: var(--pad); right: var(--pad); }

/* ----------------------------------------------------------------
   Hero — the only block on the page
---------------------------------------------------------------- */

.hero {
  position: fixed;
  z-index: 10;
  left: clamp(22px, 8vw, 140px);
  top: 26vh;
  max-width: calc(100vw - 2 * var(--pad));
}

.hero__name {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(64px, 11.5vw, 168px);
  line-height: 0.9;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(var(--bg-rgb), 0.8);
}

.hero__name .char {
  display: inline-block;
  will-change: transform, filter, opacity;
}

.hero__line {
  margin-top: clamp(22px, 3.2vh, 34px);
  font-size: clamp(9px, 1vw, 11px);
  letter-spacing: 0.42em;
  color: var(--ink-dim);
  text-shadow: 0 0 12px rgba(var(--bg-rgb), 0.9);
}

.hero__mail {
  display: inline-block;
  position: relative;
  margin-top: clamp(14px, 2.2vh, 22px);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  transition: color 0.5s ease;
  text-shadow: 0 0 12px rgba(var(--bg-rgb), 0.9);
}

.hero__mail::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero__mail:hover { color: var(--accent); }
.hero__mail:hover::after { transform: scaleX(1); transform-origin: left center; }

.hero__ledger {
  display: block;
  width: max-content;
  position: relative;
  margin-top: clamp(20px, 3vh, 30px);
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--ink-dim);
  transition: color 0.5s ease, letter-spacing 0.5s ease;
  text-shadow: 0 0 12px rgba(var(--bg-rgb), 0.9);
}

.hero__ledger::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero__ledger:hover { color: var(--accent); letter-spacing: 0.4em; }
.hero__ledger:hover::after { transform: scaleX(1); transform-origin: left center; }

.hero__ledger--drift { margin-top: 14px; }

/* ----------------------------------------------------------------
   Noscript
---------------------------------------------------------------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}

.noscript h1 { font-family: var(--font-serif); font-weight: 300; font-size: 44px; }
.noscript p { font-size: 12px; letter-spacing: 0.1em; color: var(--ink-dim); }
.noscript a { color: var(--ink); border-bottom: 1px solid var(--hairline); }

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

@media (max-width: 560px) {
  .hero { top: 26vh; left: var(--pad); }
  .hero__line { letter-spacing: 0.3em; }
  .corner--br { display: none; } /* keep three whispers, lose the least useful */
}

/* short viewports: keep the whole text stack above the waterline */
@media (max-height: 850px) {
  .hero { top: 21vh; }
}

/* ----------------------------------------------------------------
   Reduced motion
---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal] * {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* phones: the decorative clock yields to the functional toggle */
@media (max-width: 640px) {
  .corner--tr > span { display: none; }
}
