/* ─── Manuscript Portfolio — Custom Styles ─── */

:root {
  --paper: #F5F0E8;
  --ink: #2C1F14;
  --oil-umber: #8B4513;
  --warm-brown: #C19A6B;
  --oil-red: #C44D2A;
  --ember: #E85D3A;
  --teal-glow: #2A9D8F;
  --charcoal: #1A1410;
  --pencil: rgba(44, 31, 20, 0.15);
}

/* ─── Uzumaki Horror Mode ─── */
.dark-mode {
  --paper: #06080A;
  --ink: #C8C4BC;
  --oil-umber: #3A2A1A;
  --warm-brown: #4A5C48;
  --oil-red: #7A1818;
  --ember: #5A1212;
  --teal-glow: #2A7A5A;
  --charcoal: #020304;
  --pencil: rgba(60, 80, 55, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

html {
  scroll-behavior: auto;
  overflow-x: hidden;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  background-color: var(--paper);
  color: var(--ink);
  cursor: none;
  min-height: 100%;
  transition: background-color 0.8s cubic-bezier(0.4, 0.0, 0.2, 1.05),
              color 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

body.no-custom-cursor {
  cursor: auto;
}

/* Paper canvas texture */
.paper-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E"),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      var(--pencil) 28px,
      var(--pencil) 29px
    ),
    radial-gradient(ellipse at 20% 30%, rgba(139, 69, 19, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(42, 157, 143, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 90%, rgba(196, 77, 42, 0.05) 0%, transparent 35%);
}

.paper-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 39px,
    var(--pencil) 39px,
    var(--pencil) 40px
  );
  opacity: 0.3;
  pointer-events: none;
}

/* Horror vignette — breathing darkness */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(6, 8, 10, 0) 55%,
    rgba(6, 8, 10, 0.65) 100%
  );
  opacity: 0;
  transition: opacity 1.2s ease;
}

.dark-mode body::before {
  opacity: 1;
  animation: horror-breathe 6s ease-in-out infinite;
}

@keyframes horror-breathe {
  0%, 100% { opacity: 0.85; }
  50%       { opacity: 1; }
}

/* Fork & knife cursor */
.cursor-fork {
  position: fixed;
  left: 0;
  top: 0;
  display: inline-block;
  font-size: 1.5rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 10002;
  opacity: 0;
  transition: opacity 0.15s ease;
  filter: drop-shadow(0 1px 1px rgba(44, 31, 20, 0.12));
}

.dark-mode .cursor-fork {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Sketch filter for SVG elements */
.sketch-filter {
  filter: url(#sketch-wobble);
}

/* Hand-drawn buttons */
.sketch-button {
  position: relative;
  border-radius: 2px 8px 3px 6px !important;
  box-shadow: 2px 3px 0 var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sketch-button:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--ink);
}

.sketch-button-filled {
  border-radius: 4px 2px 6px 3px !important;
  box-shadow: 3px 3px 0 rgba(44, 31, 20, 0.4);
}

.sketch-button-filled:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 5px 5px 0 rgba(44, 31, 20, 0.3);
}

/* Download resume button — teal spiral variant */
.sketch-button-dl {
  box-shadow: 2px 3px 0 var(--teal-glow) !important;
}

.sketch-button-dl:hover {
  box-shadow: 4px 5px 0 var(--teal-glow) !important;
}

/* Architect of Spirals illustration */
.hero-illustration-wrapper {
  display: none;
  width: 280px;
  justify-content: center;
  align-items: center;
}

@media (min-width: 1024px) {
  .hero-illustration-wrapper {
    display: flex;
    width: 220px;
  }
}

@media (min-width: 1280px) {
  .hero-illustration-wrapper {
    width: 280px;
  }
}

.hero-illustration-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  filter: url(#sketch-wobble);
  transition: transform 0.6s ease;
  will-change: transform;
}

.hero-illustration-img:hover {
  transform: rotate(1.5deg) scale(1.03);
}

/* Avatar sketch effect */
.avatar-sketch {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  border: 3px dashed var(--ink);
  transition: transform 0.4s ease, border-color 0.3s ease;
}

.avatar-sketch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(0.6) contrast(1.1) url(#pencil-sketch);
  transition: filter 0.5s ease;
}

.avatar-sketch:hover {
  transform: rotate(3deg);
}

.avatar-sketch:hover img {
  filter: grayscale(0.2) contrast(1.05) saturate(1.2);
}

.avatar-sketch .oil-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(196, 77, 42, 0.25) 60%, rgba(42, 157, 143, 0.15) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.avatar-sketch:hover .oil-fill {
  opacity: 1;
}

/* Drawing text animation */
.drawing-text {
  display: inline-block;
  overflow: hidden;
}

.drawing-text .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
}

/* Section unfurl */
.section-unfurl {
  transform-origin: top center;
  perspective: 1200px;
}

/* Journal entry frame */
.journal-frame {
  position: relative;
  padding: 2.5rem;
  border: 2px solid var(--ink);
  border-radius: 3px 12px 4px 8px;
  background: rgba(245, 240, 232, 0.6);
  box-shadow:
    inset 0 0 30px rgba(139, 69, 19, 0.05),
    4px 6px 0 rgba(44, 31, 20, 0.08);
}

.dark-mode .journal-frame {
  background: rgba(30, 24, 20, 0.7);
}

.journal-frame::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 24px;
  width: 60px;
  height: 16px;
  background: var(--warm-brown);
  opacity: 0.4;
  border-radius: 2px;
  transform: rotate(-2deg);
}

/* Recipe / pantry cards */
.pantry-card {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px 10px 3px 8px;
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.pantry-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, transparent 50%, var(--warm-brown) 50%);
  opacity: 0.3;
}

.pantry-card:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  box-shadow: 6px 8px 0 rgba(44, 31, 20, 0.12);
}

.pantry-card .steam {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pantry-card:hover .steam {
  opacity: 1;
}

.steam-line {
  display: inline-block;
  width: 2px;
  height: 20px;
  background: var(--warm-brown);
  margin: 0 3px;
  border-radius: 2px;
  animation: steam-rise 1.5s ease-in-out infinite;
}

.steam-line:nth-child(2) { animation-delay: 0.3s; height: 16px; }
.steam-line:nth-child(3) { animation-delay: 0.6s; height: 22px; }

@keyframes steam-rise {
  0%, 100% { transform: translateY(0) scaleY(1); opacity: 0.3; }
  50% { transform: translateY(-8px) scaleY(1.2); opacity: 0.6; }
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--ink) 0px,
    var(--ink) 8px,
    transparent 8px,
    transparent 16px
  );
  opacity: 0.4;
}

.timeline-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.timeline-entry {
  position: relative;
  margin-bottom: 3rem;
  padding: 1.5rem;
  border: 1px dashed var(--ink);
  border-radius: 2px 8px 4px 6px;
  background: rgba(245, 240, 232, 0.5);
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.dark-mode .timeline-entry {
  background: rgba(30, 24, 20, 0.5);
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -2.65rem;
  top: 1.5rem;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.timeline-entry:hover,
.timeline-entry.expanded {
  opacity: 1;
  transform: translateX(4px);
  box-shadow: 3px 4px 0 rgba(44, 31, 20, 0.08);
}

.timeline-entry .details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, margin-top 0.3s ease;
}

.timeline-entry.expanded .details {
  max-height: 1200px;
  margin-top: 1rem;
}

/* Project cards */
.project-card {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 6px 3px 8px 4px;
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 8px 10px 0 rgba(44, 31, 20, 0.1);
}

.project-card.featured {
  border-width: 3px;
  border-color: var(--oil-umber);
}

/* Article cards */
.article-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 4px 10px 3px 8px;
  background: rgba(245, 240, 232, 0.7);
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.article-card:hover {
  transform: translateY(-4px) rotate(-0.3deg);
  box-shadow: 5px 6px 0 rgba(44, 31, 20, 0.1);
  border-color: var(--oil-umber);
}

.article-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.article-card-title {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink);
}

.article-card:hover .article-card-title {
  color: var(--oil-umber);
}

.article-card-date {
  font-size: 0.75rem;
  color: var(--warm-brown);
  white-space: nowrap;
  flex-shrink: 0;
}

.article-card-excerpt {
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgba(44, 31, 20, 0.7);
}

.code-block {
  background: var(--charcoal);
  color: #A8E6CF;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  padding: 1rem;
  border-radius: 4px;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.code-block code {
  white-space: nowrap;
}

.code-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(42, 157, 143, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: terminal-glow 3s ease-in-out infinite;
}

@keyframes terminal-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Sketch motif images */
.sketch-img {
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: filter 0.5s ease, transform 0.5s ease, opacity 0.4s ease;
}

.dark-mode .sketch-img {
  mix-blend-mode: screen;
  filter: brightness(0.75) contrast(1.15) saturate(0.25) hue-rotate(160deg);
  transition: filter 0.8s ease;
}

.dark-mode .sketch-img[src*="uzumaki"] {
  filter: brightness(0.75) contrast(1.2) saturate(0.3) hue-rotate(140deg)
          drop-shadow(0 0 14px rgba(42, 122, 90, 0.55));
}

.motif-float {
  pointer-events: none;
  user-select: none;
}

.spin-slow {
  animation: slow-spin 60s linear infinite;
}

.spin-reverse {
  animation: slow-spin 90s linear infinite reverse;
}

.motif-float.spin-slow {
  animation: slow-spin 90s linear infinite;
}

.motif-float.spin-reverse {
  animation: slow-spin 120s linear infinite reverse;
}

.uzumaki-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(0.85) contrast(1.05);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.uzumaki-icon-img:hover,
.sketch-frame:hover .uzumaki-icon-img {
  filter: saturate(1.1) contrast(1.1) drop-shadow(0 0 12px rgba(42, 157, 143, 0.35));
}

.sketch-frame {
  position: relative;
  border: 2px dashed var(--ink);
  border-radius: 4px 12px 3px 8px;
  padding: 0.75rem;
  background: rgba(245, 240, 232, 0.5);
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.dark-mode .sketch-frame {
  background: rgba(30, 24, 20, 0.6);
}

.sketch-frame:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 5px 6px 0 rgba(44, 31, 20, 0.1);
}

.sketch-frame .oil-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(196, 77, 42, 0.12) 70%, rgba(42, 157, 143, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.sketch-frame:hover .oil-wash {
  opacity: 1;
}

.metamorphosis-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .metamorphosis-panel {
    grid-template-columns: 200px 1fr;
  }
}

.metamorphosis-img {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  border-radius: 4px 10px 3px 8px;
  filter: grayscale(0.3) contrast(1.05);
  transition: filter 0.6s ease, transform 0.6s ease;
}

.metamorphosis-panel:hover .metamorphosis-img {
  filter: grayscale(0) contrast(1.05) saturate(1.15);
  transform: scale(1.02);
}

.motif-caption {
  font-size: 0.75rem;
  color: var(--warm-brown);
  font-style: italic;
  text-align: center;
  margin-top: 0.5rem;
}

.spiral-divider-img {
  width: 56px;
  height: 56px;
  opacity: 0.75;
  animation: slow-spin 45s linear infinite;
}

.literary-motifs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .literary-motifs {
    grid-template-columns: repeat(3, 1fr);
  }
}

.motif-card {
  text-align: center;
}

.motif-card .sketch-frame {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Spiral motifs */
.spiral-accent {
  opacity: 0.08;
  animation: slow-spin 60s linear infinite;
}

.spiral-glow {
  filter: drop-shadow(0 0 8px rgba(42, 157, 143, 0.3));
}

@keyframes slow-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spiral-loader {
  animation: slow-spin 3s linear infinite;
}

/* ─── Horror mode: accelerated spiral spin ─── */
.dark-mode .spin-slow                 { animation-duration: 15s !important; }
.dark-mode .spin-reverse              { animation-duration: 20s !important; }
.dark-mode .motif-float.spin-slow     { animation-duration: 22s !important; }
.dark-mode .motif-float.spin-reverse  { animation-duration: 28s !important; }
.dark-mode .spiral-divider-img        { animation-duration: 10s !important; }
.dark-mode .spiral-accent             { animation-duration: 12s !important; opacity: 0.18 !important; }
.dark-mode .spiral-loader             { animation-duration: 0.75s !important; }

/* Pause decorative loops while tab is hidden — saves CPU/RAM */
.page-hidden .spin-slow,
.page-hidden .spin-reverse,
.page-hidden .spiral-divider-img,
.page-hidden .spiral-accent,
.page-hidden .spiral-loader,
.page-hidden .scroll-indicator-chevron,
.page-hidden .steam-line,
.page-hidden .will-to-power,
.page-hidden .uzumaki-toggle-icon {
  animation-play-state: paused;
}

/* Nietzsche quote pulse */
.will-to-power {
  animation: power-pulse 4s ease-in-out infinite;
}

@keyframes power-pulse {
  0%, 100% { text-shadow: none; }
  50% { text-shadow: 0 0 20px rgba(196, 77, 42, 0.3); }
}

/* Kafka beetle morph */
.beetle-motif {
  display: inline-block;
  vertical-align: middle;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: 0.35rem;
  transition: transform 0.6s ease;
}

.beetle-motif img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(0.4);
  transition: filter 0.5s ease, transform 0.5s ease;
}

.beetle-motif:hover {
  transform: scale(1.15) rotate(8deg);
}

.beetle-motif:hover img {
  filter: grayscale(0) saturate(1.2) drop-shadow(0 0 8px rgba(42, 157, 143, 0.4));
}

/* Section dividers */
.spiral-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 4rem 0;
  opacity: 0.5;
}

.spiral-divider line {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

/* Diploma frame */
.diploma-frame {
  position: relative;
  padding: 2rem 3rem;
  border: 3px double var(--oil-umber);
  border-radius: 2px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.diploma-frame::before,
.diploma-frame::after {
  content: '✦';
  position: absolute;
  color: var(--warm-brown);
  font-size: 1.2rem;
}

.diploma-frame::before { top: 8px; left: 12px; }
.diploma-frame::after { bottom: 8px; right: 12px; }

/* Nav */
.site-nav {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: rgba(245, 240, 232, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ink);
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.dark-mode .site-nav {
  background: rgba(6, 8, 10, 0.92);
  border-color: rgba(42, 122, 90, 0.25);
}

.dark-mode .site-nav a:hover,
.dark-mode .site-nav a.active {
  background: rgba(42, 122, 90, 0.12);
}

.dark-mode .mobile-nav {
  background: rgba(6, 8, 10, 0.97);
  border-top-color: rgba(42, 122, 90, 0.2);
}

.dark-mode .mobile-nav-link:hover,
.dark-mode .mobile-nav-link.active {
  background: rgba(42, 122, 90, 0.1);
  color: var(--teal-glow);
}

.site-nav.visible {
  opacity: 1;
}

.site-nav a {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(139, 69, 19, 0.15);
}

/* Mobile bottom navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.5rem 0.35rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: rgba(245, 240, 232, 0.95);
  backdrop-filter: blur(10px);
  border-top: 2px solid var(--ink);
  box-shadow: 0 -4px 0 rgba(44, 31, 20, 0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0.2rem;
}

.mobile-nav-link {
  flex: 1 0 auto;
  min-width: 4.25rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  border-radius: 8px 4px 10px 3px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  line-height: 1.2;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: rgba(139, 69, 19, 0.12);
  border-color: rgba(44, 31, 20, 0.15);
  color: var(--oil-umber);
}

/* Limitly spiral counter */
.rate-counter {
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  color: var(--teal-glow);
  position: relative;
}

.rate-counter .spiral-ring {
  position: absolute;
  inset: -20px;
  border: 2px solid var(--teal-glow);
  border-radius: 50%;
  opacity: 0.3;
  animation: slow-spin 8s linear infinite;
}

/* Footer doodle icons */
.doodle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--ink);
  border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%;
  transition: transform 0.3s ease, background 0.3s ease;
}

.doodle-icon:hover {
  transform: rotate(-5deg) scale(1.1);
  background: rgba(42, 157, 143, 0.1);
}

/* Scroll down indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--warm-brown);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer !important;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.scroll-indicator:hover {
  color: var(--oil-umber);
}

.scroll-indicator.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
}

.scroll-indicator-chevron {
  opacity: 0.8;
}

@media (prefers-reduced-motion: no-preference) {
  .scroll-indicator-chevron {
    animation: chevron-bounce 1.1s ease-in-out infinite;
  }
}

@keyframes chevron-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* Parallax layers */
.parallax-layer,
.parallax-content {
  contain: layout style;
}

/* Loading screen */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ─── Tailwind utility overrides for Uzumaki horror mode ─── */
.dark-mode .text-ink           { color: var(--ink) !important; }
.dark-mode .text-ink\/90       { color: rgba(200, 196, 188, 0.90) !important; }
.dark-mode .text-ink\/80       { color: rgba(200, 196, 188, 0.80) !important; }
.dark-mode .text-ink\/70       { color: rgba(200, 196, 188, 0.70) !important; }
.dark-mode .text-ink\/60       { color: rgba(200, 196, 188, 0.60) !important; }
.dark-mode .text-ink\/50       { color: rgba(200, 196, 188, 0.50) !important; }
.dark-mode .text-ink\/40       { color: rgba(200, 196, 188, 0.40) !important; }
.dark-mode .text-warm-brown    { color: var(--warm-brown) !important; }
.dark-mode .text-oil-red       { color: var(--oil-red) !important; }
.dark-mode .text-ember         { color: var(--ember) !important; }
.dark-mode .text-teal-glow     { color: var(--teal-glow) !important; }
.dark-mode .text-oil-umber     { color: var(--oil-umber) !important; }
.dark-mode .text-paper         { color: var(--paper) !important; }
.dark-mode .bg-paper           { background-color: var(--paper) !important; }
.dark-mode .bg-ink             { background-color: var(--ink) !important; }
.dark-mode .bg-charcoal        { background-color: var(--charcoal) !important; }
.dark-mode .bg-teal-glow       { background-color: var(--teal-glow) !important; }
.dark-mode .bg-oil-umber       { background-color: var(--oil-umber) !important; }
.dark-mode .bg-teal-glow\/10   { background-color: rgba(42, 122, 90, 0.10) !important; }
.dark-mode .bg-warm-brown\/20  { background-color: rgba(74, 92, 72, 0.20) !important; }
.dark-mode .border-ink         { border-color: var(--ink) !important; }
.dark-mode .border-ink\/10     { border-color: rgba(200, 196, 188, 0.10) !important; }
.dark-mode .border-ink\/20     { border-color: rgba(200, 196, 188, 0.20) !important; }
.dark-mode .border-teal-glow   { border-color: var(--teal-glow) !important; }
.dark-mode .border-oil-red     { border-color: var(--oil-red) !important; }
.dark-mode .hover\:bg-ink:hover        { background-color: var(--ink) !important; }
.dark-mode .hover\:bg-teal-glow:hover  { background-color: var(--teal-glow) !important; }
.dark-mode .hover\:text-paper:hover    { color: var(--paper) !important; }
.dark-mode .hover\:text-teal-glow:hover { color: var(--teal-glow) !important; }

/* ─── Uzumaki theme toggle — fixed top right ─── */
.uzumaki-toggle {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(245, 240, 232, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  border: 1px solid rgba(44, 31, 20, 0.2);
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease,
              box-shadow 0.3s ease, opacity 0.5s ease;
}

.uzumaki-toggle.visible {
  opacity: 1;
  pointer-events: auto;
}

.uzumaki-toggle:hover {
  background: rgba(245, 240, 232, 0.95);
  border-color: var(--oil-umber);
  box-shadow: 0 2px 12px rgba(44, 31, 20, 0.12);
}

.dark-mode .uzumaki-toggle {
  color: var(--teal-glow);
  background: rgba(6, 8, 10, 0.85);
  border-color: rgba(42, 122, 90, 0.35);
}

.dark-mode .uzumaki-toggle:hover {
  background: rgba(6, 8, 10, 0.95);
  border-color: var(--teal-glow);
  box-shadow: 0 2px 16px rgba(42, 122, 90, 0.2);
}

.uzumaki-toggle-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  transition: transform 0.4s ease;
  flex-shrink: 0;
}

.dark-mode .uzumaki-toggle-icon {
  animation: slow-spin 3s linear infinite;
  filter: drop-shadow(0 0 4px rgba(42, 122, 90, 0.7));
}

/* Responsive — tablet */
@media (max-width: 1024px) {
  .site-nav {
    max-width: calc(100% - 2rem);
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    border-radius: 16px;
  }

  .site-nav a {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }
}

/* Responsive — mobile */
@media (max-width: 768px) {
  html {
    scroll-behavior: auto;
  }

  body {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .parallax-layer,
  .parallax-content,
  .paper-canvas {
    will-change: auto;
  }

  #hero {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: max(2.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: 2rem;
    min-height: 100svh;
  }

  #hero .avatar-sketch {
    width: 9rem;
    height: 9rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
  }

  body {
    cursor: auto;
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .cursor-fork {
    display: none !important;
  }

  .site-nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .journal-frame {
    padding: 1.25rem;
  }

  .diploma-frame {
    padding: 1.5rem 1.25rem;
  }

  .throughput-benchmark {
    display: none;
  }

  .scroll-indicator {
    display: none;
  }

  .hero-cta .sketch-button,
  .hero-cta .sketch-button-filled,
  .hero-cta .sketch-button-dl {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .article-card {
    padding: 1rem 1.1rem;
  }

  .article-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .article-card-title {
    font-size: 0.98rem;
  }

  .timeline {
    padding-left: 1.25rem;
  }

  .timeline-entry {
    padding: 1.1rem;
    margin-bottom: 2rem;
  }

  .timeline-entry::before {
    left: -1.85rem;
    width: 10px;
    height: 10px;
  }

  .project-card {
    padding: 1.25rem !important;
  }

  .project-card.featured .flex-col {
    gap: 1.25rem;
  }

  .rate-counter {
    font-size: 1.5rem;
  }

  .spiral-divider {
    margin: 2.5rem 0;
    gap: 0.5rem;
  }

  .spiral-divider svg {
    width: 40px;
  }

  .metamorphosis-panel {
    margin: 1.25rem 0;
  }

  .pantry-card {
    padding: 1.25rem;
  }

  h2.text-3xl {
    font-size: 1.65rem;
    line-height: 1.25;
  }
}

@media (max-width: 380px) {
  #hero .avatar-sketch {
    width: 8rem;
    height: 8rem;
  }

  .mobile-nav-link {
    min-width: 3.75rem;
    font-size: 0.6rem;
    padding: 0.4rem 0.35rem;
  }

  .hero-title {
    font-size: 2rem !important;
  }

  .jitter-text {
    letter-spacing: 0.12em !important;
    font-size: 0.7rem;
  }
}

/* Nest Hub, Nest Hub Max & other short landscape viewports */
@media (max-height: 820px) {
  html {
    scroll-behavior: auto;
  }

  body {
    cursor: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .cursor-fork {
    display: none !important;
  }

  .site-nav {
    display: none !important;
  }

  .mobile-nav {
    display: flex !important;
  }

  .parallax-layer,
  .parallax-content,
  .paper-canvas {
    will-change: auto;
  }

  #hero {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1.25rem 1.5rem 1.5rem;
    min-height: auto !important;
  }

  .hero-layout {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
    width: 100%;
  }

  .hero-illustration-wrapper {
    display: none !important;
  }

  #hero .avatar-sketch {
    width: 5.5rem !important;
    height: 5.5rem !important;
    margin-bottom: 0.75rem;
  }

  #hero .hero-title {
    font-size: 2.25rem !important;
    line-height: 1.1;
  }

  #hero .hero-tagline {
    font-size: 0.95rem !important;
    margin-top: 0.5rem !important;
  }

  #hero .jitter-text {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
  }

  #hero .hero-cta {
    margin-top: 0.75rem !important;
    gap: 0.5rem !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    max-width: 100% !important;
  }

  #hero .hero-cta .sketch-button,
  #hero .hero-cta .sketch-button-filled,
  #hero .hero-cta .sketch-button-dl {
    width: auto;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.8rem !important;
  }

  #hero .hero-contact {
    margin-top: 0.75rem !important;
    font-size: 0.75rem;
    gap: 1rem !important;
  }

  .scroll-indicator {
    display: none;
  }

  .throughput-benchmark {
    display: none;
  }
}

/* Nest Hub (1024×600) & Nest Hub Max (1280×800) — wide, short landscape */
@media (min-width: 769px) and (max-height: 820px) {
  #hero {
    padding: 1rem 1.5rem 1.25rem;
  }

  #hero .hero-layout > .flex-1 {
    display: grid;
    grid-template-columns: 5rem 1fr;
    column-gap: 1.25rem;
    row-gap: 0.3rem;
    text-align: left;
    align-items: start;
    width: 100%;
  }

  #hero .hero-layout > .flex-1 > .avatar-sketch {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 5rem !important;
    height: 5rem !important;
    margin: 0 !important;
    align-self: center;
  }

  #hero .hero-layout > .flex-1 > .jitter-text {
    grid-column: 2;
    grid-row: 1;
    margin: 0 !important;
    align-self: end;
  }

  #hero .hero-layout > .flex-1 > .hero-title {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
    margin: 0 !important;
  }

  #hero .hero-layout > .flex-1 > p.hero-tagline {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 0.35rem !important;
    justify-content: flex-start !important;
  }

  #hero .hero-layout > .flex-1 > .hero-cta {
    grid-column: 1 / -1;
    justify-content: flex-start !important;
    margin-top: 0.5rem !important;
    max-width: 100% !important;
  }

  #hero .hero-layout > .flex-1 > .hero-contact {
    grid-column: 1 / -1;
    justify-content: flex-start !important;
    margin-top: 0.35rem !important;
  }
}

@media (min-width: 769px) and (min-height: 821px) {
  .mobile-nav {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}