:root {
  --bg: #f5f5f1;
  --ink: #0a0a0a;
  --ascii-image-offset: 12%;
  --ascii-text-offset: -1%;
  --ascii-mask-start: 72%;
  --ascii-mask-soft: 92%;
  --muted: #6f6f68;
  --line: rgba(10, 10, 10, 0.14);
  --panel: #ffffff;
  --inverse: #050505;
  --inverse-text: #f8f8f3;
  --soft-shadow: rgba(10, 10, 10, 0.28);
  --max: 1440px;
  --gutter: clamp(18px, 3vw, 48px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Consolas, "Roboto Mono", Menlo, Monaco, "Courier New", monospace;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

#main {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
}

.scroll-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Inner wrapper carries the subtle "rolling screen" tilt so the
   scrollbar (on .scroll-container) is never transformed/distorted.
   The small scale() overscans the viewport so the tilted edges never
   reveal the background behind the section. */
.scroll-content {
  transform: perspective(1600px) rotateX(var(--roll-rx, 0deg)) scale(1.04);
  transform-origin: center center;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-content {
    transform: none;
  }
}

.page-section {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 60px);
  scroll-snap-align: start;
}

.page-content {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  max-width: var(--max);
  margin: 0 auto;
  gap: clamp(40px, 6vw, 80px);
  width: 100%;
}

.page-section:nth-child(2) {
  justify-content: flex-start;
}

.page-section:nth-child(2) .page-content {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

/* Hard override for the About section (page2) and Works section (page3) */
#page2.page-section {
  justify-content: flex-start;
  align-items: center;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 60px);
  min-height: 100vh;
  overflow: visible;
}

#page3.page-section {
  justify-content: flex-start;
  align-items: center;
  padding: 0 clamp(20px, 4vw, 60px);
  height: 100vh;
  overflow: visible;
}

#page2.page-section .page-content,
#page3.page-section .page-content {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  flex: 0 1 auto;
  gap: clamp(24px, 4vw, 40px);
  max-width: 900px;
}

#page3.page-section .page-content.works-section {
  position: relative;
  max-width: none;
  width: 100%;
  height: 100%;
  gap: 0;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
  overflow: hidden;
}

#page3.page-section .about-section__title {
  font-size: clamp(4rem, 9vw, 8rem);
  flex: 0 0 auto;
  position: relative;
  z-index: 10;
  margin-top: clamp(40px, 6vh, 60px);
  margin-bottom: clamp(16px, 2vh, 24px);
  pointer-events: none;
}

#page2.page-section .about-section__title,
#page2.page-section .about-section__tagline,
#page2.page-section .about-section__bio,
#page3.page-section .about-section__title {
  text-align: center;
  width: 100%;
}

#page2.page-section .about-section__title {
  margin-top: clamp(24px, 3vh, 40px);
}

#page2.page-section .about-section__title,
#page3.page-section .about-section__title {
  margin-bottom: 0;
}

#page2.page-section .about-section__tagline {
  margin-bottom: 0;
}

#page2.page-section .about-section__docs {
  margin: 0;
}

/* Add side columns (CV thumbnail left / cover letter right) while keeping bio centered */
#page2.page-section .about-section__title,
#page2.page-section .about-section__tagline,
#page2.page-section .about-section__bio,
#page2.page-section .about-side-label {
  position: relative;
  z-index: 2;
}

/* Keep About text readable on the (light) background video */
#page2.page-section .about-section__title,
#page2.page-section .about-section__tagline,
#page2.page-section .about-section__bio,
#page2.page-section .about-side-label {
  color: var(--ink);
}

.about-section__docs {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(40px, 6vw, 80px);
  width: 100%;
  position: relative;
  z-index: 10;
  pointer-events: none;
  margin-top: -34px; /* Offset the tagline's margin-top to keep docs in place */
}

#page2.page-section .about-section__side {
  z-index: 10;
  width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  pointer-events: auto;

  /* Override `.reveal` so the thumbnails are not stuck invisible */
  opacity: 1 !important;
}
#page2.page-section .about-section__side--left {
  left: clamp(28px, 5vw, 80px);
}

#page2.page-section .about-section__side--right {
  right: clamp(28px, 5vw, 80px);
}

#page2.page-section .about-section__side img {
  width: min(360px, 28vw);
  height: auto;
  max-height: 550px;
  object-fit: cover;
  border-radius: 2.5px;
  box-shadow: 0 10px 40px rgba(10, 10, 10, 0.25);
  position: relative;
  z-index: 4;
}
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 var(--gutter);
  height: 60px;
}

.brand {
  display: block;
  width: 60px;
  height: 60px;
  position: relative;
}
.site-nav {
  display: flex;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  pointer-events: auto;
  line-height: 1;
}

.site-nav a {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-decoration: none;
  text-transform: lowercase;
  pointer-events: auto;
  transition: opacity 0.2s var(--ease), text-shadow 0.3s var(--ease);
  /* Ensure stable width during scrambling */
  display: inline-block;
  min-width: max-content;
}

.site-nav a:hover {
  opacity: 1;
}

/* Bold the nav item for the section currently in view (smooth faux-bold via
   animated text-shadow, since font-weight can't transition smoothly) */
.site-nav a.is-current:not(.scrambling) {
  text-shadow:
    0.35px 0 0 var(--ink),
    -0.35px 0 0 var(--ink),
    0 0.35px 0 var(--ink),
    0 -0.35px 0 var(--ink);
}

/* Keep full opacity + prevent selection while the decode scramble is running on hover */
.scrambling {
  opacity: 1 !important;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: auto;
}

/* Make the logo visible/positioned like a top-left brand */
.site-header > a.brand {
  pointer-events: auto;
  cursor: pointer !important;
  position: fixed;
  top: 10px;
  left: 18px;
  z-index: 11;
}

/* Logo hover animation styles */
.logo-container {
  position: relative;
  display: block;
  width: 60px;
  height: 60px;
  overflow: hidden;
}

.logo-image,
.logo-video {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
}

.logo-video {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background: transparent;
  background-color: transparent;
  mix-blend-mode: normal;
}

.logo-image {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.grain {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999; pointer-events: none;
}
.grain::before {
    content: ""; position: fixed; top: -10rem; left: -10rem;
    width: calc(100% + 20rem); height: calc(100% + 20rem);
    background-image: url(https://upload.wikimedia.org/wikipedia/commons/5/5c/Image_gaussian_noise_example.png);
    opacity: 0.15; animation: noise 1s steps(2) infinite; pointer-events: none;
}
@keyframes noise {
    0%   { transform: translate3d(0, 9rem, 0); }
    10%  { transform: translate3d(-1rem, -4rem, 0); }
    20%  { transform: translate3d(-8rem, 2rem, 0); }
    30%  { transform: translate3d(9rem, -9rem, 0); }
    40%  { transform: translate3d(-2rem, 7rem, 0); }
    50%  { transform: translate3d(-9rem, -4rem, 0); }
    60%  { transform: translate3d(2rem, 6rem, 0); }
    70%  { transform: translate3d(7rem, -8rem, 0); }
    80%  { transform: translate3d(-9rem, 1rem, 0); }
    90%  { transform: translate3d(6rem, -5rem, 0); }
    100% { transform: translate3d(-7rem, 0, 0); }
}

.bloom {
    position: fixed; inset: 0; z-index: 500; pointer-events: none;
    -webkit-backdrop-filter: blur(0.7px) brightness(1.1);
    backdrop-filter: blur(0.7px) brightness(1.1);
}

/* Cursor tilt on hover */
[data-tilt-cursor] {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 120ms ease;
  transform: perspective(800px) rotateX(0deg) rotateY(0deg);
}

.about-section__title {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: clamp(4rem, 9vw, 8rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.9;
  margin: 0 0 24px;
  text-transform: lowercase;
  color: var(--ink);
  position: relative;
  display: inline-block;
}

/* ASCII glitch effect layers */
.glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: lowercase;
  pointer-events: none;
  will-change: transform, opacity, clip-path;
}

.about-section__tagline {
  font-family: "Consolas", "Roboto Mono", monospace;
  /* small-to-big lines look */
  font-size: clamp(0.82rem, 1.2vw, 1.02rem);
  line-height: 1.55;
  color: var(--ink);

  /* spacing between heading and tagline */
  margin: 0 !important;
  margin-top: 26px !important;

  font-weight: 400;
  text-align: center;

  /* normal flow */
  display: block;
  transform: none !important;
  position: static !important;
}

/* Decode effect styles */
.about-section__tagline.decode-effect {
  position: relative;
  min-height: 3.5em; /* Prevent layout shift during decoding */
}

.about-section__tagline.decode-effect .char {
  display: inline-block;
  opacity: 0;
  animation: charReveal 0.05s ease forwards;
}

/* Prevent layout shifts in CV and cover letter during decode */
.about-section__docs {
  transform: translateZ(0); /* GPU acceleration */
  backface-visibility: hidden;
}

@keyframes charReveal {
  to {
    opacity: 1;
  }
}

.about-section__tagline br {
  content: "";
}

/* small-to-big multiline look under About */
.tagline-line {
  display: block;
}

.tagline-line--1 {
  font-size: clamp(0.78rem, 1.08vw, 0.98rem);
}

.tagline-line--2 {
  font-size: clamp(0.85rem, 1.18vw, 1.06rem);
}

.tagline-line--3 {
  font-size: clamp(0.92rem, 1.30vw, 1.14rem);
}

.about-section__bio {
  margin-bottom: clamp(48px, 6vw, 64px);
}

.about-section__bio p {

  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 clamp(14px, 2vw, 22px);
  font-weight: 400;
  transform-origin: center center;
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-header] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

[data-header].is-scrolled {
  pointer-events: auto;
}

[data-tilt] {
  transition: transform 0.1s ease;
}

@media (max-width: 991px) {
  .about-section__inner {
    flex-direction: column;
    align-items: center;
  }
  
  .about-section__content {
    flex: auto;
  }
}

/* ---- Audio control (jaskushii-style circular) ---- */
.audio-control {
  position: fixed;
  bottom: 80px;
  left: clamp(20px, 4vw, 40px);
  z-index: 1000;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 10, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 44px;
  height: 44px;
  border-radius: 50px;
  opacity: 0.55;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.15s ease-out,
              filter 0.15s ease-out,
              transform 0.15s ease-out;
}

.mute-btn {
  min-width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.3s;
  outline: none;
  cursor: pointer;
}

.mute-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 3px;
  border-radius: 2px;
  background: rgba(10, 10, 10, 0.2);
  outline: none;
  opacity: 0;
  margin-right: 10px;
  transition: opacity 0.3s;
  pointer-events: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 3px rgba(0,0,0,0.15);
}

.volume-slider::-moz-range-thumb {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  box-shadow: 0 0 3px rgba(0,0,0,0.15);
}

.audio-control.is-unmuted:hover {
  width: 200px;
  padding: 0 14px 0 0;
}

.audio-control.is-unmuted:hover .volume-slider {
  opacity: 1;
  pointer-events: auto;
}

.audio-control__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.audio-control__song {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  line-height: 1;
  margin-bottom: 2px;
  transition: opacity 0.2s ease;
  pointer-events: none;
  cursor: pointer;
}

.audio-control.is-unmuted:hover .audio-control__song {
  opacity: 0.7;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 767px) {
  .audio-control { bottom: 70px; left: 20px; }
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 40px);
  z-index: 10;
}

.site-footer__brand {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: calc(clamp(0.8rem, 1.2vw, 1rem) * 0.76);
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-decoration: none;
  transform: translateY(0);
  display: inline-flex;

  align-items: center;
  line-height: 1;
}
.site-footer__brand:hover {
  opacity: 1;
}

.site-footer__year {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: calc(clamp(0.8rem, 1.2vw, 1rem) * 0.76);
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-decoration: none;
  transform: translateY(0);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.site-footer__year .small-c {
  font-weight: 700;
  font-size: inherit;
  transform: none;
  display: inline-block;
}

.site-footer__year:hover {
  opacity: 1;
}
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

.cursor__inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease), height 0.2s var(--ease), background 0.2s var(--ease);
  mix-blend-mode: difference;
}

.cursor__inner.hover {
  width: 80px;
  height: 80px;
  background: var(--bg);
}

.cursor__text {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink);
  text-transform: lowercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  white-space: nowrap;
}

.cursor__text.visible {
  opacity: 1;
}

.background-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  transition: opacity 0.8s var(--ease);
}

/* About section background video — full-viewport FIXED layer so it always
   covers the homepage video when the about section is active (no peeking
   through the tilted content, even during fast scroll). */
.about-background-video {
  position: fixed;
  top: -5vh;
  left: 0;
  width: 100vw;
  height: 110vh;
  object-fit: cover;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

body.about-active .about-background-video {
  opacity: 1;
}

/* ==============================
   Document viewer (CV + Cover Letter)
   ============================== */
.doc-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Closing transition (no delay) */
  transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.doc-viewer[aria-hidden="false"] {
  pointer-events: auto;
  opacity: 1;
  /* Opening transition */
  transition: opacity 100ms ease-out;
}

/* Backdrop — blur fades in via opacity */
.doc-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  opacity: 0;
  transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.doc-viewer[aria-hidden="false"] .doc-viewer__backdrop {
  opacity: 1;
  transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Panel — scales up + slides up + fades in */
.doc-viewer__panel {
  position: relative;
  z-index: 1;
  width: min(900px, 90vw);
  height: min(800px, 86vh);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  color-scheme: light;
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.18),
    0 12px 40px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;

  /* Closing: faster, no delay */
  transform: scale(0.94) translateY(16px);
  opacity: 0;
  transition:
    transform 240ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.doc-viewer[aria-hidden="false"] .doc-viewer__panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  /* Opening: slightly longer, small delay to sync with backdrop */
  transition:
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1) 60ms,
    opacity 300ms cubic-bezier(0.22, 1, 0.36, 1) 60ms;
}

.doc-viewer__download {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;

  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;

  background: rgba(10, 10, 10, 0.9);
  border: 1px solid rgba(10, 10, 10, 0.12);
  color: #fff;
  text-decoration: none;
  backdrop-filter: blur(8px);

  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.doc-viewer__download:hover {
  transform: translateY(-1px);
  background: #000;
}

.doc-viewer__download:active {
  transform: scale(0.97);
}

.doc-viewer__pdf-scroll {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  background: #f5f5f5;
  position: relative;
  /* Hide native scrollbar */
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}

.doc-viewer__pdf-scroll::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari/Opera */
}

/* Zoom wrapper holds all pages, scales with slider */
.doc-viewer__pdf-zoom-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Each page container: canvas behind, text-layer on top */
.doc-viewer__page {
  position: relative;
  display: block;
  line-height: 0;
  overflow: hidden;
}

.doc-viewer__page canvas {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* Text layer — invisible but selectable & clickable */
.doc-viewer__page .textLayer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  line-height: 1;
  z-index: 2;
  pointer-events: auto;
}

.doc-viewer__page .textLayer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  pointer-events: auto;
}

.doc-viewer__page .textLayer > span::selection {
  background: rgba(0, 100, 255, 0.3);
  color: transparent;
}

.doc-viewer__page .textLayer > a {
  position: absolute;
  color: transparent;
  cursor: pointer;
  text-decoration: none;
  pointer-events: auto;
}

.doc-viewer__page .textLayer > a:hover {
  background: rgba(0, 100, 255, 0.12);
  border-radius: 2px;
}

/* Iframe fallback for file:// protocol */
.doc-viewer__pdf-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  color-scheme: light;
  display: none;
}

.doc-viewer__panel.is-iframe-mode .doc-viewer__pdf-scroll {
  display: none;
}

.doc-viewer__panel.is-iframe-mode .doc-viewer__pdf-iframe {
  display: block;
}

/* Keep zoom toolbar visible in iframe mode (no longer hidden) */

/* Zoom toolbar at bottom of panel */
.doc-viewer__toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid rgba(10, 10, 10, 0.08);
  flex-shrink: 0;
}

.doc-viewer__zoom-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(10, 10, 10, 0.14);
  background: #f5f5f5;
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 120ms ease;
  flex-shrink: 0;
}

.doc-viewer__zoom-btn:hover {
  background: #e8e8e8;
}

.doc-viewer__zoom-btn:active {
  background: #ddd;
}

/* Range slider track & thumb */
.doc-viewer__zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.doc-viewer__zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 120ms ease;
}

.doc-viewer__zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.doc-viewer__zoom-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--ink);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.doc-viewer__zoom-label {
  font-family: "Consolas", "Roboto Mono", monospace;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  min-width: 36px;
  text-align: center;
}

/* Prevent scrolling/layout interactions while viewer is open */
body.doc-viewer-open {
  overflow: hidden;
}

/* Mobile adjustments */
@media (max-width: 520px) {
  .doc-viewer__panel {
    width: 94vw;
    height: 90vh;
    border-radius: 10px;
  }

  .doc-viewer__download {
    top: 10px;
    right: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

/* ============================================================
   Works globe — project cards on a rotating 3D sphere
   (port of michalzalobny.com's globe mode: golden-angle sphere
   distribution, depth fade on the far hemisphere, drag/scroll
   rotation, plus a rings-and-dots rotation hint)
   ============================================================ */
.works-globe {
  position: absolute;
  inset: 0;
  top: clamp(60px, 10vh, 100px);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

.works-globe__stage {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1400px;
  perspective-origin: 50% 46%;
  cursor: grab;
  touch-action: pan-y;
  pointer-events: auto;
}

.works-globe__stage.is-dragging {
  cursor: grabbing;
}

.works-globe__group {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}/* ---- wireframe hoops (canvas-rendered, two rings with scrambling characters) ---- */
.works-globe__hoops {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 10;
}

.works-globe__hoop-canvas {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;

}

/* ---- sphere cards (reference style: image tile + accent frame) ---- */
.work-card {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(148px, 12.5vw, 190px);
  aspect-ratio: 16 / 10;
  margin: 0;
  backface-visibility: visible;
}

.work-card__inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 8px;
  overflow: hidden;
  background: var(--art, linear-gradient(150deg, #17171c 0%, #0b0b0e 62%));
  border: 1px solid color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow:
    0 14px 30px -14px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 22px -6px color-mix(in srgb, var(--accent) 45%, transparent);
  cursor: pointer;
  transform-style: flat;
  will-change: transform;
}

.work-card__art {
  position: relative;
  flex: 1;
  min-height: 0;
}

.work-card__art::before {
  /* subtle light sweep so the tile reads as a lit image, like the reference */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0) 42%);
  pointer-events: none;
}

.work-card__glyph {
  position: absolute;
  right: 7%;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(2.6rem, 4.6vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.4);
  user-select: none;
}

.work-card__index {
  position: absolute;
  left: 10px;
  top: 8px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--accent);
  opacity: 0.95;
}

.work-card__ring {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 20px;
  height: 20px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.6;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent);
}

.work-card__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

.work-card__name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f5f5f1;
  white-space: nowrap;
}

.work-card__tag {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(245, 245, 241, 0.5);  white-space: nowrap;
}

/* ---- reduced motion: static sphere, no spin ---- */
@media (prefers-reduced-motion: reduce) {
  .work-card__inner {
    transition: none;
  }

  .works-globe__hoops {
    animation: none;
  }
}

/* ---- mobile fallback: flat 2-column grid of the same cards ---- */
@media (max-width: 767px) {
  #page3.page-section {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .works-globe {
    position: relative;
    flex: 1 1 auto;
    align-items: flex-start;
    overflow: visible;
    width: 100%;
  }

  .works-globe__stage {
    perspective: none;
    cursor: default;
    touch-action: auto;
    height: auto;
  }

  .works-globe__group {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    transform: none !important;
    transform-style: flat;
  }

  .works-globe__hoops {
    display: none;
  }

  .work-card {
    position: static;
    width: 100%;
    transform: none !important;
    opacity: 1 !important;
  }

}

@media (max-width: 420px) {
  .works-globe__group {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

