/* ============================================================
   Josiah Legg - Portfolio
   ============================================================ */

/* ---------- Color themes ---------- */
:root[data-theme="light"] {
  --text: #0f0d08;
  --background: #fefae7;
  --primary: #a69e5f;
  --secondary: #a3ccba;
  --accent: #80b4b8;
}

:root[data-theme="dark"] {
  --text: #f6f4ee;
  --background: #181501;
  --primary: #a19959;
  --secondary: #335c4a;
  --accent: #487c7f;
}

/* ---------- Design tokens ---------- */
:root {
  /* Typography */
  --font-secondary: "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-logo: "Bricolage Grotesque", system-ui, sans-serif;

  /* Easing */
  --ease-in-out-sine: cubic-bezier(.445, .05, .55, .95);
  --ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
  --ease-out-elastic: linear(0, .5737 7.6%, .8382 11.87%, .9463 14.19%, 1.0292 16.54%, 1.0886 18.97%,
      1.1258 21.53%, 1.137 22.97%, 1.1424 24.48%, 1.1423 26.1%, 1.1366 27.86%,
      1.1165 31.01%, 1.0507 38.62%, 1.0219 42.57%, .9995 46.99%, .9872 51.63%,
      .9842 58.77%, 1.0011 81.26%, 1);

  /* Theme transition */
  --theme-transition-duration: 0.4s;

  /* Content stage: a fixed-width column centered in the area right of
     the sidebar, then nudged 10% further right. --stage-pad is the LEFT
     padding; % resolves against .main-content, so only use it on direct
     children of main (.hero, .page-section). */
  --stage-w: 68rem;
  --stage-pad: max(4rem, calc((100% - var(--stage-w)) / 2 + 10%));

  /* Sidebar content (logo/nav) starts ~10% across the screen; the
     sidebar box widens to absorb the inset. */
  --sidebar-inset: 10vw;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- Base ---------- */
html {
  font-family: var(--font-secondary);
  /* Fluid root scale. Design reference is 2560x1440 at 17.6px:
     0.6875vw = 17.6px @ 2560w, 1.2223vh = 17.6px @ 1440h.
     min() keeps ultrawides height-bound; the floor keeps text readable
     on small desktops. Everything sized in rem scales proportionally. */
  font-size: clamp(13px, min(0.6875vw, 1.2223vh), 26.4px);
  color: var(--text);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Reserve the scrollbar gutter so pages that don't scroll (home,
     short reader-mode pages) don't shift relative to pages that do. */
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary), transparent 35%) transparent;
}

/* WebKit custom scrollbar */
::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary), transparent 35%);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

html::before,
html::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

html::after {
  mix-blend-mode: multiply;
  opacity: 0.5;
}

html::before {
  mix-blend-mode: screen;
  opacity: 0.4;
}

body {
  background-color: transparent;
  color: var(--text);
  transition:
    background-color var(--theme-transition-duration) var(--ease-in-out-sine),
    color var(--theme-transition-duration) var(--ease-in-out-sine);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  width: 100%;
}

/* ---------- Skip to content ---------- */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100000;
  padding: 0.6rem 1rem;
  background-color: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-150%);
  transition: transform 0.2s var(--ease-out-cubic), opacity 0.2s ease;
}

.skip-link:focus {
  opacity: 1;
  transform: translateY(0);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   Header / Sidebar
   ============================================================ */
.site-header {
  width: calc(23rem + var(--sidebar-inset));
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 5rem;
  padding: 16rem 10rem 20rem var(--sidebar-inset);
  background-color: transparent;
  transition: background-color var(--theme-transition-duration) var(--ease-in-out-sine);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 12;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding-right: 2.5rem;
  color: var(--text);
  transition: color var(--theme-transition-duration) var(--ease-in-out-sine);
}

.logo-icon {
  height: 1.7em;
  width: 1.7em;
  flex-shrink: 0;
}

.logo-icon-bg {
  fill: var(--background);
  transition: fill var(--theme-transition-duration) var(--ease-in-out-sine);
}

.logo-icon-text {
  font-family: var(--font-logo);
  font-weight: 600;
  font-size: 48px;
  letter-spacing: -0.01em;
  fill: var(--text);
  transition: fill var(--theme-transition-duration) var(--ease-in-out-sine);
}

.logo-text {
  font-family: var(--font-logo);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* ---- Hamburger ---- */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  touch-action: manipulation;
}

.hamburger svg {
  fill: var(--text);
  transition: fill var(--theme-transition-duration) var(--ease-in-out-sine);
  overflow: visible;
}

.hamburger rect {
  transform-origin: center;
  transition: transform 0.8s var(--ease-out-elastic);
}

.hamburger[aria-expanded="true"] rect:first-child {
  transform: translateY(2.7px) rotate(45deg);
}

.hamburger[aria-expanded="true"] rect:last-child {
  transform: translateY(-2.7px) rotate(-45deg);
}

/* ---- Header controls (theme toggle + hamburger) ---- */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle,
.reader-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  margin: -0.4rem;
  color: var(--text);
  border-radius: 99px;
  touch-action: manipulation;
  transition: color var(--theme-transition-duration) var(--ease-in-out-sine), opacity 0.2s ease;
}

.theme-toggle:hover,
.reader-toggle:hover {
  opacity: 0.65;
}

.theme-toggle svg,
.reader-toggle svg {
  width: 0.9rem;
  height: 0.9rem;
  stroke: currentColor;
  fill: none;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* ---- Nav ---- */
.site-nav {
  position: relative;
  pointer-events: none;
}

.site-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.5rem 0;
  color: var(--text);
  font-family: var(--font-secondary);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  pointer-events: auto;
  outline: none;
  position: relative;
  transition:
    opacity 0.4s ease,
    filter 0.4s ease,
    color var(--theme-transition-duration) var(--ease-in-out-sine);
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.25rem;
  bottom: -0.25rem;
}

@media (hover: hover) {
  .site-nav:hover .nav-link {
    filter: blur(1.5px);
    opacity: 0.2;
  }

  .nav-link:hover {
    filter: none !important;
    opacity: 1 !important;
  }
}

.site-nav:has(.nav-link:focus-visible) .nav-link {
  filter: blur(1.5px);
  opacity: 0.2;
}

.nav-link:focus-visible {
  filter: none !important;
  opacity: 1 !important;
}

.site-nav.blur-enter .nav-link {
  filter: blur(1.5px);
  opacity: 0.2;
  transition: none;
}

.external-arrow {
  width: 0.455rem;
  height: 0.455rem;
  margin-top: 0.125rem;
  fill: var(--text);
  opacity: 0;
  transition: opacity 0.4s ease, fill var(--theme-transition-duration) var(--ease-in-out-sine);
}

.nav-link.external:hover .external-arrow {
  opacity: 1;
}

.nav-dot {
  display: none;
  width: 0.25rem;
  height: 0.25rem;
  background-color: var(--accent);
  border-radius: 50%;
  position: absolute;
  left: -0.5rem;
  top: 0;
  transition:
    background-color var(--theme-transition-duration) var(--ease-in-out-sine),
    opacity 0.4s ease,
    filter 0.4s ease;
}

.site-nav.has-active .nav-dot {
  display: block;
}

/* ---------- Main content ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 3.5rem 4rem;
  min-height: 100vh;
  opacity: 0;
  filter: blur(12px);
  transition:
    opacity 0.4s var(--ease-out-cubic),
    filter 0.4s var(--ease-out-cubic);
}

.main-content.is-visible {
  opacity: 1;
  filter: blur(0);
}

.main-content:focus {
  outline: none;
}

/* ---------- Hero ---------- */
.main-content:has(.hero) {
  padding: 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-rows: 0.6fr auto 1.0fr;
  justify-items: start;
  height: 100vh;
  padding: 3.5rem 4rem 3.5rem var(--stage-pad);
}

.hero-eyebrow {
  grid-row: 1;
  align-self: end;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.4;
  margin: 0 0 1.5rem;
}

.hero-title {
  grid-row: 2;
  font-family: var(--font-logo);
  font-size: clamp(2.75rem, 5.5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}

.hero-body {
  grid-row: 3;
  align-self: start;
  font-size: 1.05rem;
  line-height: 1.65;
  opacity: 0.6;
  max-width: 38ch;
  margin: 1.25rem 0 0;
}

.hero-below {
  grid-row: 3;
  align-self: start;
  margin-top: 1.25rem;
}

.hero-below .hero-body {
  margin-top: 0;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  margin-top: 2.25rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--primary), transparent 45%);
  padding-bottom: 0.15rem;
  transition:
    gap 0.3s var(--ease-out-cubic),
    border-color 0.3s ease,
    color var(--theme-transition-duration) var(--ease-in-out-sine);
}

.hero-link:hover {
  gap: 0.7rem;
  border-color: var(--primary);
}

.hero-link svg {
  width: 0.7em;
  height: 0.7em;
  fill: currentColor;
}

.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: var(--stage-pad);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.35;
}

.scroll-hint svg {
  width: 0.57rem;
  height: 0.68rem;
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  55% {
    transform: translateY(5px);
  }
}

/* ---------- Multi-section layout ---------- */
@media (min-width: 768px) {
  .main-content:has(.hero) .page-section {
    min-height: 100vh;
    padding: 3.5rem 4rem 3.5rem var(--stage-pad);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Grid sections skip the stage lean: leaned cards would crowd the
     right edge of the screen. Overriding --stage-pad keeps the label
     and scroll hint aligned with the grid for free. */
  .main-content:has(.hero) .page-section:has(.projects-grid) {
    --stage-pad: max(4rem, calc((100% - var(--stage-w)) / 2));
  }
}

/* ---------- Section dots ---------- */
.section-dots {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}

.section-dot {
  width: max(4px, 0.285rem);
  height: max(4px, 0.285rem);
  border-radius: 50%;
  border: none;
  background-color: var(--text);
  opacity: 0.2;
  cursor: pointer;
  padding: 0;
  transition:
    opacity 0.35s var(--ease-in-out-sine),
    transform 0.35s var(--ease-out-elastic),
    background-color var(--theme-transition-duration) var(--ease-in-out-sine);
}

.section-dot.active {
  opacity: 0.65;
  transform: scale(1.5);
}

.section-dot:hover {
  opacity: 0.45;
}

.section-dot.active:hover {
  opacity: 0.65;
}

/* ---------- Page section ---------- */
.page-section {
  position: relative;
  padding: 4rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.4;
  margin: 0 0 1.75rem;
}

/* ---------- Project cards ---------- */
.projects-grid {
  display: grid;
  /* 17rem min keeps the stage at 3 columns; wider cards wrap the long
     descriptions into fewer lines so the cards stay shorter. */
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  max-width: var(--stage-w);
}

.project-card {
  border: 1px solid color-mix(in srgb, var(--primary), transparent 55%);
  border-radius: 0.5rem;
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

.project-card:hover {
  border-color: var(--primary);
  background-color: color-mix(in srgb, var(--primary), transparent 92%);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.project-card-title {
  font-family: var(--font-logo);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.project-card-arrow {
  width: 0.455rem;
  height: 0.455rem;
  flex-shrink: 0;
  opacity: 0;
  fill: var(--text);
  transition: opacity 0.2s ease;
}

.project-card:hover .project-card-arrow {
  opacity: 1;
}

.project-card-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.6;
  margin: 0;
}

.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.tag {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 45%);
  opacity: 0.7;
}

/* ---------- About page ---------- */
.about-content {
  max-width: 52ch;
}

.about-content p {
  font-size: 1.0625rem;
  line-height: 1.75;
  opacity: 0.75;
  margin: 0 0 1.25rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

/* ---------- Contact page ---------- */
.contact-content {
  max-width: 52ch;
}

.contact-intro {
  font-size: 1.0625rem;
  line-height: 1.75;
  opacity: 0.75;
  margin: 0 0 2.5rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  max-width: 34rem;
}

.contact-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid color-mix(in srgb, var(--primary), transparent 70%);
  transition: opacity 0.3s ease;
}

.contact-link:last-child {
  border-bottom: 1px solid color-mix(in srgb, var(--primary), transparent 70%);
}

.contact-link-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
  flex-shrink: 0;
}

.contact-link-value {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-logo);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: right;
}

.contact-link-value .external-arrow {
  position: static;
  width: 0.5em;
  height: 0.5em;
  margin-top: 0;
  transform: none;
  opacity: 0;
}

.contact-link:hover .contact-link-value .external-arrow,
.contact-link:focus-visible .contact-link-value .external-arrow {
  opacity: 1;
}

/* ---- Email copy-to-clipboard ---- */
.contact-copy {
  cursor: pointer;
}

.contact-copy .contact-link-value {
  position: relative;
}

.copy-default,
.copy-feedback {
  transition:
    opacity 0.3s var(--ease-out-cubic),
    transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.copy-default {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-icon {
  width: 0.5em;
  height: 0.5em;
  fill: none;
  stroke: var(--text);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.contact-copy:hover .copy-icon,
.contact-copy:focus-visible .copy-icon {
  opacity: 1;
}

.copy-feedback {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  color: var(--accent);
  opacity: 0;
  transform: translateY(0.35rem) scale(0.96);
  transform-origin: right center;
  pointer-events: none;
}

.copy-feedback svg {
  width: 0.8em;
  height: 0.8em;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-copy.copied .copy-default {
  opacity: 0;
  transform: translateY(-0.3rem);
}

.contact-copy.copied .copy-feedback {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {

  .copy-default,
  .copy-feedback {
    transition: opacity 0.2s ease;
  }

  .copy-feedback,
  .contact-copy.copied .copy-default {
    transform: none;
  }
}

/* ---------- Small desktop / tablet ----------
   Compact sidebar for tablets and laptop-class widths; the full
   33rem sidebar only earns its keep from ~1536px up. */
@media (min-width: 768px) and (max-width: 1535px) {
  :root {
    --stage-pad: max(3rem, calc((100% - var(--stage-w)) / 2 + 10%));
  }

  .site-header {
    width: calc(15rem + var(--sidebar-inset));
    padding: 8rem 2rem 6rem var(--sidebar-inset);
    gap: 3rem;
  }

  .logo {
    padding-right: 1rem;
  }

  .main-content {
    padding: 3rem;
  }

  .hero,
  .main-content:has(.hero) .page-section {
    padding: 3rem 3rem 3rem var(--stage-pad);
  }

  .main-content:has(.hero) .page-section:has(.projects-grid) {
    --stage-pad: max(3rem, calc((100% - var(--stage-w)) / 2));
  }
}

/* ---------- Short viewports ---------- */
@media (min-width: 768px) and (max-height: 820px) {
  .site-header {
    padding-block: 8rem 6rem;
    gap: 3rem;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  html {
    /* Phone reference: ~16px at a 375px-wide viewport. */
    font-size: clamp(15px, 4.27vw, 17.6px);
  }

  body {
    flex-direction: column;
  }

  .site-header {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    gap: 0;
    padding: 1.25rem 1.5rem;
  }

  .hamburger {
    display: inline-flex;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 1.5rem;
    padding: 0 2rem 9rem;
    background-color: color-mix(in srgb, var(--background), transparent 60%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    text-align: center;
  }

  .site-nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-link {
    font-size: 1.85rem;
    font-weight: 400;
    letter-spacing: 0;
  }

  .nav-dot {
    display: none !important;
  }

  .external-arrow {
    position: absolute;
    left: calc(100% + 0.5em);
    top: 50%;
    transform: translateY(-50%);
    width: 0.5em;
    height: 0.5em;
    margin-top: 0;
    opacity: 1;
  }

  .main-content {
    padding: 2rem 1.5rem;
    min-height: auto;
    width: 100%;
  }

  .page-section {
    padding: 2.5rem 1.5rem 4rem;
  }

  .hero {
    height: calc(100vh - 4.5rem);
    height: calc(100svh - 4.5rem);
    padding: 2rem 1.5rem;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-eyebrow,
  .hero-title,
  .hero-body,
  .hero-below {
    max-width: 100%;
  }

  .scroll-hint {
    left: 1.5rem;
  }

  /* Sections aren't full-screen panels on mobile, so a mid-page
     scroll indicator is just noise. */
  .page-section .scroll-hint {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {

  .main-content,
  .main-content.is-visible {
    filter: none;
  }

  .main-content {
    transition: opacity 0.2s ease;
  }
}

/* ============================================================
   Reader mode
   ============================================================
   A plain, single-column document view: fixed readable type, no
   animations, no full-screen panels, normal scrolling. The grain
   overlay stays. Kept at the end of the file so it wins specificity
   ties against the layout rules and media queries above. */
:root[data-reader] {
  font-size: 17px;
  /* Reading column: 46rem, centered. */
  --reader-pad: max(1.5rem, calc(50% - 23rem));
}

/* No motion */
:root[data-reader] *,
:root[data-reader] *::before,
:root[data-reader] *::after {
  transition: none !important;
  animation: none !important;
}

:root[data-reader] body {
  display: block;
}

/* ---- Header becomes a simple document header ---- */
:root[data-reader] .site-header {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  gap: 1.25rem;
  padding: 2rem var(--reader-pad) 0;
}

:root[data-reader] .hamburger {
  display: none;
}

:root[data-reader] .site-nav {
  position: static;
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  padding: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  text-align: left;
}

:root[data-reader] .site-nav ul {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1.5rem;
}

:root[data-reader] .nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  filter: none !important;
  opacity: 1 !important;
}

:root[data-reader] .nav-link[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

:root[data-reader] .nav-dot {
  display: none !important;
}

:root[data-reader] .external-arrow {
  position: static;
  transform: none;
  width: 0.455rem;
  height: 0.455rem;
  margin-top: 0.125rem;
  opacity: 1;
}

:root[data-reader] .reader-toggle {
  color: var(--accent);
  opacity: 1;
}

/* ---- Content flows as one readable column ---- */
:root[data-reader] .main-content,
:root[data-reader] .main-content:has(.hero) {
  padding: 1.5rem var(--reader-pad) 4rem;
  min-height: auto;
  opacity: 1;
  filter: none;
}

:root[data-reader] .hero {
  display: block;
  height: auto;
  padding: 0;
}

:root[data-reader] .hero-eyebrow {
  margin: 0 0 0.75rem;
}

:root[data-reader] .hero-title {
  font-size: 2.25rem;
  line-height: 1.15;
}

:root[data-reader] .hero-body {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 65ch;
  margin: 0.75rem 0 0;
}

:root[data-reader] .hero-below {
  margin-top: 0.75rem;
}

:root[data-reader] .scroll-hint,
:root[data-reader] .section-dots {
  display: none !important;
}

:root[data-reader] .page-section,
:root[data-reader] .main-content:has(.hero) .page-section {
  min-height: 0;
  display: block;
  padding: 2.5rem 0 0;
}

:root[data-reader] .section-label {
  margin: 0 0 1rem;
}

:root[data-reader] .projects-grid {
  grid-template-columns: 1fr;
  gap: 0.85rem;
  max-width: none;
}

:root[data-reader] .project-card-arrow {
  opacity: 1;
}

:root[data-reader] .about-content,
:root[data-reader] .contact-content {
  max-width: 65ch;
}

:root[data-reader] .about-content p,
:root[data-reader] .contact-intro {
  font-size: 1rem;
  line-height: 1.7;
}

:root[data-reader] .copy-icon,
:root[data-reader] .contact-link-value .external-arrow {
  opacity: 1;
}