/* Shared design tokens. Dark is the default, independent of the OS theme. */
:root {
  color-scheme: dark;
  --bg: #10171c;
  --surface: #192126;
  --surface-raised: #202a31;
  --section-bg: #141d23;
  --text: #f1f2f2;
  --muted: #b7c0c9;
  --border: #344049;
  --tag: #263039;
  --button-bg: #d3dae0;
  --button-text: #172028;
  --focus: #b1d7ff;
  --shadow: 0 12px 32px #00000020;
  --radius: 10px;
  --radius-sm: 5px;
  --page-width: 1280px;
  --gutter: clamp(20px, 5vw, 72px);
  --section-space: clamp(44px, 5vw, 72px);
  --sans: 'Segoe UI', Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-synthesis: none;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-raised: #edf0f3;
  --section-bg: #f0f2f5;
  --text: #17212c;
  --muted: #53616e;
  --border: #d6dce2;
  --tag: #edf0f4;
  --button-bg: #303d47;
  --button-text: #ffffff;
  --focus: #245b99;
  --shadow: 0 12px 32px #1b29300a;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 96px; }
body { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 6px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--text); }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.045em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(3.1rem, 6.2vw, 5.5rem); }
h2 { font-size: clamp(2rem, 3.1vw, 3rem); }
h3 { font-size: 1.22rem; line-height: 1.3; font-weight: 600; }
p { color: var(--muted); }
a, p, h1, h2, h3, li { overflow-wrap: anywhere; }
img { max-width: 100%; display: block; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; stroke-width: 1.6; }
.container { width: min(var(--page-width), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 20px; padding: 12px 20px; background: var(--button-bg); color: var(--button-text); }
.skip-link:focus { top: 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .65rem; font-weight: 600; color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 20px; min-height: 48px; padding: 12px 20px; background: var(--button-bg); color: var(--button-text); border: 1px solid transparent; border-radius: var(--radius-sm); font-size: .86rem; font-weight: 600; text-decoration: none; transition: border-color .18s; }
.button:hover { filter: brightness(1.08); }
.button-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.button-secondary:hover { background: var(--surface-raised); border-color: var(--muted); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text); flex-shrink: 0; }
.icon-button:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--muted); }
.text-link { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; font-size: .86rem; font-weight: 600; text-decoration: underline; text-decoration-color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* Shared navigation */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 78px; position: relative; }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; flex-shrink: 0; min-height: 44px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); font-family: var(--serif); font-size: 1.2rem; letter-spacing: -.06em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.4; }
.brand-text strong { font-size: .95rem; font-weight: 600; }
.brand-text>span { color: var(--muted); font-size: .75rem; }
.desktop-nav, .footer-nav { display: flex; align-items: center; gap: 26px; }
.desktop-nav a, .footer-nav a { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .76rem; text-decoration: none; }
.desktop-nav a:hover, .footer-nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-contact { min-height: 44px; padding: 9px 15px; font-size: .8rem; gap: 10px; }
.theme-toggle { border-color: transparent; background: transparent; }
.theme-toggle span { display: flex; }
[data-theme='dark'] .moon-icon, [data-theme='light'] .sun-icon { display: none; }
.menu-toggle { display: none; border-radius: var(--radius-sm); }
.mobile-nav { position: absolute; top: calc(100% + 1px); left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); padding: 12px var(--gutter) 20px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.mobile-nav a { display: flex; align-items: center; min-height: 48px; text-decoration: none; font-size: .95rem; border-bottom: 1px solid var(--border); }

/* Hero: only the photograph is raster. All copy and controls remain HTML. */
.hero { position: relative; isolation: isolate; border-bottom: 1px solid var(--border); }
.hero-inner { padding-block: 62px 66px; position: relative; }
.hero-copy { width: 57%; max-width: 710px; }
.hero h1 { margin: 15px 0 12px; }
.profession { color: var(--text); font-size: clamp(1.05rem, 1.6vw, 1.35rem); line-height: 1.4; max-width: 680px; }
.hero-description { max-width: 605px; margin-top: 23px; font-size: .91rem; line-height: 1.75; }
.hero-visual { position: absolute; z-index: -1; inset: 0 0 0 38%; background: url('/images/hero/desk.webp') center 56% / cover no-repeat; }
.hero-visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 0%, #10171ccc 16%, #10171c00 52%), linear-gradient(0deg, var(--bg), #10171c00 25%); }
[data-theme='light'] .hero-visual::after { background: linear-gradient(90deg, var(--bg) 0%, #f7f8faf0 17%, #f7f8fa00 56%), linear-gradient(0deg, var(--bg), #f7f8fa00 22%); }
[data-theme='light'] .hero-visual { background-image: url('/images/hero/desk-light.webp'); }

/* Projects */
.section { padding-block: var(--section-space); scroll-margin-top: 0; }
.section-heading { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 48px; margin-bottom: 28px; }
.section-heading h2 { margin-top: 12px; }
.section-heading>p, .section-heading>div>p:not(.eyebrow) { max-width: 510px; font-size: .86rem; line-height: 1.6; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.project-card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.professional-card { display: flex; flex-direction: column; padding: 24px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.card-top>.icon { width: 29px; height: 29px; color: var(--muted); }
.category-label { font-size: .64rem; color: var(--muted); padding: 3px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--tag); }
.professional-card h3 { min-height: 3.9em; }
.project-description { font-size: .87rem; line-height: 1.65; }
.professional-card .project-description { margin: 15px 0 18px; flex-grow: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li { background: var(--tag); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); padding: 3px 8px; font-size: .68rem; line-height: 1.5; }
.project-summary { font-size: .72rem; margin-top: 15px; }
.card-link { align-self: flex-start; margin-top: 14px; }
.personal-section { background: var(--section-bg); border-block: 1px solid var(--border); }
.project-segments { display: flex; align-items: stretch; border: 1px solid var(--border); padding: 4px; border-radius: 7px; margin-top: 16px; width: min(100%, 390px); }
.project-segments a { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; flex: 1 1 0; min-width: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: .85rem; text-decoration: none; }
.project-segments a:hover { background: var(--surface-raised); color: var(--text); }
.personal-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; }
.personal-stack .personal-slide { scroll-margin-top: 100px; }
.photo-carousel { min-width: 0; align-self: start; }
.photo-track::after { display: none; }
.photo-slide { flex: 0 0 100%; min-width: 0; margin: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.photo-slide .screenshot-link { width: 100%; aspect-ratio: 16/10; }
.photo-slide img { width: 100%; height: 100%; object-fit: contain; }
.photo-slide figcaption { display: none; }
.photo-caption { color: var(--muted); font-size: .75rem; margin-top: 14px; min-height: 3.2em; }
.photo-stage { position: relative; }
.photo-stage .photo-track { padding: 4px 4%; gap: 12px; scroll-padding-inline: 0; }
.photo-stage .photo-slide { scroll-snap-align: center; }
.photo-stage .screenshot-link { transition: opacity .25s, transform .25s; }
.photo-slide[data-active='false'] .screenshot-link { opacity: .55; transform: scale(.96); }
.photo-stage>.icon-button { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 48px; background: var(--surface-raised); border-color: var(--muted); box-shadow: 0 3px 16px #00000040; }
.photo-stage>.carousel-prev { left: 0; }
.photo-stage>.carousel-next { right: 0; }
.photo-stage>.icon-button:disabled { opacity: .65; background: var(--surface); border-color: var(--border); }
.photo-carousel .carousel-controls { position: relative; justify-content: center; }
.photo-carousel .carousel-dots { margin-inline: auto; }
.photo-carousel .carousel-count { position: absolute; right: 0; }
.photo-carousel .carousel-controls { gap: 4px; }
.photo-carousel .carousel-count { white-space: nowrap; }
.project-segments button[aria-pressed='true'] { color: var(--button-text); background: var(--button-bg); border-color: var(--button-bg); }
.project-segments button:hover:not([aria-pressed='true']) { background: var(--surface-raised); color: var(--text); }
.carousel { min-width: 0; }
.carousel-track { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; position: relative; padding: 2px 2px 8px; scroll-padding-inline: 2px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track::after { content: ''; flex: 0 0 calc(5% - 20px); }
.personal-slide { flex: 0 0 95%; min-width: 0; display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); scroll-snap-align: start; scroll-snap-stop: always; }
.project-preview { display: flex; position: relative; min-width: 0; min-height: 280px; align-items: center; background: #0c1217; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.project-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.personal-copy { min-width: 0; display: flex; flex-direction: column; padding: 8px 0; }
.personal-copy h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 2.3vw, 2rem); letter-spacing: -.025em; margin: 12px 0 16px; }
.personal-copy .tags { margin-top: 18px; }
.personal-links { display: flex; flex-wrap: wrap; gap: 6px 24px; padding-top: 18px; margin-top: auto; }
.visit-site { color: var(--muted); }
.carousel-controls { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.carousel-dots { display: flex; margin-left: auto; }
.carousel-dots button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; border-radius: 50%; }
.carousel-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .45; }
.carousel-dots button[aria-pressed='true'] span { background: var(--text); opacity: 1; }
.carousel-count { margin-left: auto; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Contact and footer */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 22px 36px; align-items: center; }
.contact-grid h2 { margin-top: 12px; }
.contact-grid>p { font-size: .85rem; }
.contact-details { display: flex; flex-direction: column; align-items: flex-start; }
.contact-details a { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: .85rem; text-decoration: none; }
.contact-grid>.button { grid-column: 3; justify-self: start; }
.site-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; padding-block: 25px; border-top: 1px solid var(--border); }
.footer-nav { margin-left: auto; gap: 20px; }
.footer-nav a { font-size: .67rem; }
.footer-social { display: flex; gap: 16px; }
.copyright { font-size: .65rem; line-height: 1.5; }

/* Project details and original screenshot galleries */
.detail { max-width: 1080px; padding-block: 30px 60px; }
.detail-header { padding-block: 38px; max-width: 950px; }
.detail-header h1 { font-size: clamp(2.3rem, 4.6vw, 4rem); margin: 18px 0 24px; }
.detail-description { max-width: 850px; font-size: 1rem; }
.detail-header .tags { margin-top: 24px; }
.site-url { margin-top: 15px; }
.site-url a { overflow-wrap: anywhere; }
.gallery-block { min-width: 0; margin: 0 0 38px; }
.gallery-hint { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; font-size: .85rem; }
.gallery-hint span { display: inline-flex; align-items: center; gap: 10px; font-size: .75rem; }
.screenshot-gallery { display: flex; gap: 18px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 5px 5px 18px; scrollbar-color: var(--muted) var(--surface); }
.screenshot { flex: 0 0 min(82%, 640px); min-width: 0; margin: 0; scroll-snap-align: start; }
.screenshot-link { display: flex; align-items: center; justify-content: center; background: #0c1217; border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 16/10; }
.screenshot img { width: 100%; height: 100%; object-fit: contain; }
.screenshot figcaption { font-size: .78rem; color: var(--muted); margin-top: 12px; }
.screenshot-placeholder { display: grid; place-items: center; width: 100%; aspect-ratio: 16/10; padding: 20px; font-size: .85rem; color: var(--muted); background: var(--surface-raised); }
.detail-sections section { display: grid; grid-template-columns: 50px 1fr; gap: 26px; padding: 32px 0; border-top: 1px solid var(--border); }
.detail-sections h2 { font-size: 1.9rem; }
.detail-sections p { white-space: pre-line; margin-top: 18px; max-width: 850px; font-size: .96rem; }
.detail-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); margin-top: 32px; padding-top: 26px; }
.empty-state { padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* No-script fallback keeps navigation and every project accessible. */
html:not(.js) .carousel-track { display: grid; overflow: visible; }
html:not(.js) .carousel-controls, html:not(.js) .theme-toggle, html:not(.js) .menu-toggle { display: none; }
html:not(.js) .photo-stage>.icon-button, html:not(.js) .photo-caption { display: none; }
html:not(.js) .photo-slide figcaption { display: block; }
html:not(.js) .mobile-nav[hidden] { display: flex !important; position: static; flex-wrap: wrap; padding: 0; border: 0; gap: 14px; }

@media (max-width: 1100px) {
  .desktop-nav { gap: 15px; }
  .header-inner { gap: 16px; }
  .hero-copy { width: 62%; }
  .personal-slide { gap: 22px; grid-template-columns: 1fr 1fr; }
  .professional-card { padding: 20px; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid>.button { grid-column: auto; }
  .footer-nav { display: none; }
  .copyright { margin-left: auto; }
}

@media (max-width: 960px) {
  .project-grid { grid-template-columns: 1fr; }
  .professional-card h3 { min-height: 0; }
  .desktop-nav { display: none; }
  .menu-toggle { display: flex; }
  .hero-copy { width: 72%; }
  .hero-visual { inset-inline-start: 38%; opacity: .6; }
  .hero-visual::after { background: linear-gradient(90deg, var(--bg), #10171cbb 55%, #10171c22); }
  [data-theme='light'] .hero-visual::after { background: linear-gradient(90deg, var(--bg), #f7f8fabb 55%, #f7f8fa22); }
  .section-heading { gap: 25px; }
  .professional-card h3 { font-size: 1.08rem; }
  .project-grid { gap: 14px; }
  .personal-slide { grid-template-columns: 1fr; }
  .project-preview { min-height: 0; height: 320px; }
  .project-preview img { height: 100%; object-fit: contain; }
  .personal-copy { padding: 0; }
}

@media (max-width: 700px) {
  .photo-carousel .carousel-dots { display: none; }
  .photo-carousel .carousel-count { margin-inline: auto; }
  .photo-carousel .carousel-controls { min-height: 28px; margin-top: 0; }
  .photo-carousel .carousel-count { position: static; }
  .photo-stage>.icon-button { width: 44px; height: 44px; }
  html { scroll-padding-top: 84px; }
  .header-inner { min-height: 70px; gap: 10px; }
  .header-contact { display: none; }
  .header-actions { gap: 3px; }
  .hero-inner { padding-block: 42px 44px; }
  .hero-copy { width: 100%; max-width: 560px; }
  .hero h1 { font-size: clamp(3rem, 10vw, 4rem); }
  .hero-visual { inset: 0; opacity: .22; }
  .hero-visual::after { background: linear-gradient(90deg, var(--bg), #10171c88), linear-gradient(0deg, var(--bg), #10171c00 60%); }
  [data-theme='light'] .hero-visual { opacity: .2; }
  [data-theme='light'] .hero-visual::after { background: linear-gradient(90deg, var(--bg), #f7f8fa88), linear-gradient(0deg, var(--bg), #f7f8fa00 60%); }
  .hero-description { font-size: .88rem; }
  .actions { gap: 10px; }
  .hero .actions .button { width: 100%; justify-content: space-between; }
  .section-heading { grid-template-columns: 1fr; gap: 16px; }
  .section-heading h2 { font-size: 2.2rem; }
  .project-grid { grid-template-columns: 1fr; gap: 16px; }
  .professional-card { padding: 22px; }
  .professional-card h3 { min-height: 0; font-size: 1.18rem; }
  .card-top { margin-bottom: 14px; }
  .project-segments { width: 100%; }
  .personal-slide { flex-basis: 94%; padding: 14px; gap: 20px; }
  .carousel-track { gap: 12px; }
  .carousel-track::after { flex-basis: calc(6% - 12px); }
  .project-preview { height: 205px; }
  .personal-copy h3 { font-size: 1.6rem; margin-bottom: 14px; }
  .personal-copy .project-description { font-size: .85rem; }
  .personal-links { gap: 6px 18px; }
  .contact-grid { grid-template-columns: 1fr; gap: 24px; }
  .contact-grid>.button { justify-self: stretch; }
  .site-footer { gap: 20px; }
  .footer-social:empty { display: none; }
  .copyright { font-size: .62rem; }
  .detail-header { padding-top: 26px; }
  .detail-sections section { grid-template-columns: 25px 1fr; gap: 15px; }
  .detail-sections h2 { font-size: 1.7rem; }
  .screenshot { flex-basis: 92%; }
  .site-url a { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Immersive screenshot galleries: a single native scrolling track. */
.personal-stack .personal-slide { grid-template-columns: minmax(0, 1fr); padding: 24px 0; gap: 16px; background: transparent; border-inline: 0; border-radius: 0; }
.personal-stack .personal-copy { max-width: 920px; padding: 0 24px; margin-inline: auto; width: 100%; }
.photo-stage { isolation: isolate; }
.photo-stage .photo-track { gap: 20px; padding: 24px 17%; scroll-padding-inline: 0; cursor: grab; touch-action: pan-x pan-y pinch-zoom; }
.photo-stage .photo-slide { flex: 0 0 100%; position: relative; scroll-snap-align: center; scroll-snap-stop: always; }
.photo-stage .photo-track::after { display: block; content: ''; flex: 0 0 0; margin-left: -20px; }
.photo-stage .screenshot-link { aspect-ratio: 16 / 10; border-radius: 12px; border: 1px solid var(--border); background: #050708; overflow: hidden; box-shadow: 0 12px 24px #00000026; transition: none; transform-origin: center; cursor: inherit; user-select: none; -webkit-user-drag: none; }
.photo-stage .photo-slide[data-active='false'] .screenshot-link { opacity: 1; }
.photo-stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; border-radius: 0; mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent), linear-gradient(to right, transparent, #000 8px, #000 calc(100% - 8px), transparent); mask-composite: intersect; }
.photo-stage .photo-track.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.photo-stage>.carousel-prev { left: 4px; }
.photo-stage>.carousel-next { right: 4px; }
.photo-meta { display: flex; align-items: baseline; gap: 16px; padding: 0 24px; }
.photo-meta .photo-caption { margin: 0; min-height: 3.2em; flex: 1; }
.photo-meta .carousel-count { position: static; flex: none; white-space: nowrap; }
.photo-carousel .carousel-controls { margin: 8px 24px 0; }
.photo-carousel .photo-thumbnails { position: relative; display: flex; justify-content: flex-start; gap: 8px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 5px; margin-inline: auto; }
.photo-thumbnails::-webkit-scrollbar { display: none; }
.photo-carousel .photo-thumbnails button { flex: 0 0 88px; width: 88px; height: 58px; border-radius: 6px; border: 2px solid transparent; opacity: .6; overflow: hidden; background: var(--surface); padding: 2px; }
.photo-thumbnails img { width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }
.photo-carousel .photo-thumbnails button[aria-pressed='true'] { border-color: var(--text); opacity: 1; }
.photo-thumbnails button:hover { opacity: 1; }
.photo-viewer { width: 96vw; max-width: 1600px; height: 94dvh; max-height: 94dvh; padding: 64px 64px 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.photo-viewer::backdrop { background: #000c; }
.photo-viewer[open] { display: grid; place-items: center; }
.photo-viewer figure { margin: 0; width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.photo-viewer figure>img { width: 100%; height: 100%; min-height: 0; object-fit: contain; flex: 1; }
.photo-viewer figcaption { font-size: .85rem; text-align: center; }
.photo-viewer>.icon-button { position: absolute; background: var(--surface-raised); }
.viewer-close { top: 10px; right: 10px; }
.viewer-prev { left: 8px; top: 50%; }
.viewer-next { right: 8px; top: 50%; }
@media(max-width: 700px) {
  .photo-stage .photo-track { padding: 16px 12%; gap: 10px; }
  .photo-stage .photo-track::after { margin-left: -10px; }
  .photo-stage>.icon-button { width: 44px; height: 44px; }
  .photo-stage>.carousel-prev { left: 0; }
  .photo-stage>.carousel-next { right: 0; }
  .photo-meta, .personal-stack .personal-copy { padding-inline: 4px; }
  .photo-carousel .carousel-controls { margin-inline: 0; }
  .photo-carousel .photo-thumbnails button { flex-basis: 64px; width: 64px; height: 46px; }
  .photo-viewer { width: 100vw; padding: 60px 46px 20px; }
}
@media(prefers-reduced-motion: reduce) {
  .photo-stage .screenshot-link { transform: none !important; box-shadow: none; }
}
html:not(.js) .photo-track { padding: 0; }
html:not(.js) .photo-track::after { display: none; }

.photo-stage .photo-track { z-index: 0; }
