/* ============================================================
   Le Petukhin — landing page
   Minimalist · white field · grayscale base · one accent per screen
   Headlines: Noto Sans · Body: Noto Serif (Noto Sans/Serif SC for CJK)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --ink: #1b1b1b;
  --ink-soft: #2f2f2f;
  --muted: #6f6f6f;
  --hairline: #d8d8d8;
  --paper: #ffffff;
  --paper-2: #f6f6f4;

  /* One distinct accent per screen — kept muted to stay "grayscale-ish" */
  --accent-bio: #2f4858; /* slate blue */
  --accent-gallery: #9c5b3b; /* burnt sienna */
  --accent-writings: #4a5d3a; /* olive — used by Media screen */
  --accent-books: #3d6663; /* muted teal */
  --accent-contacts: #6d2e46; /* wine */

  --maxw: 1120px;
  --rail: clamp(1.25rem, 5vw, 4rem);

  /* Headline sizes — shrunk by 40% when the screen height is below 720px.
     Note: this threshold matches the `.screen` min-height of 720px; on
     shorter viewports headlines shrink so tall content still fits one screen. */
  --fs-name: clamp(2.4rem, 1rem + 6vw, 3.2rem);
}
@media (max-height: 719px) {
  :root {
    --fs-name: clamp(1.44rem, 0.6rem + 3.6vw, 2.76rem); /* ×0.6 */
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
/* smooth scrolling is driven by JS (js/main.js) */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: "Noto Serif", "Noto Serif SC", Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: "Noto Sans", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.08;
  margin: 0;
}

/* ---------- Layout shells ---------- */
.scroll {
}

.screen {
  position: relative;
  /* Each screen fills the viewport when it's taller than 720px (no neighbor
     partials visible at rest), with 720px as the minimum height on shorter
     viewports.   */
  height: max(100vh, 720px);
  display: flex;
}

.screen__inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 2.25rem var(--rail);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Content wrapper sits below the head and stretches (flex:1) to fill the
   remaining screen height, so the screen always looks filled. */
.screen__content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center; /* vertically center the content block */
  min-height: 0;
}
/* Tall-content screen: keep the top (title + name) visible, clip the bottom. */
.screen--bio .screen__content {
  justify-content: flex-start;
}
/* Contacts screen: center the small block horizontally too. */
.screen--contacts .screen__content {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.screen__head {
  flex: 0 0 auto;
  margin-bottom: clamp(1.25rem, 3vh, 2.25rem);
}

.screen__index {
  display: none;
}

.num {
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-weight: 700;
  color: var(--ink);
}

/* ============================================================
   Brand + side dot nav
   ============================================================ */
.brand {
  position: fixed;
  top: 1.15rem;
  left: 1.4rem;
  z-index: 50;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  color: var(--ink);
  opacity: 0.85;
}

/* Language switch — sticky under the brand, top-left */
.lang {
  position: fixed;
  top: 20px;
  right: 1.4rem;
  z-index: 50;
  display: flex;
  gap: 0.3rem;
  font-size: 1.15rem;
  line-height: 1;
}
.lang__btn {
  padding: 0.1rem 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.45;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.lang__btn:hover {
  opacity: 1;
}
.lang__btn.is-active {
  opacity: 1;
  transform: scale(1.12);
}
.lang__btn:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
@media (max-width: 720px) {
  /*.lang { font-size: 1rem; top: 3rem; }*/
}

.dots {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}
.dot {
  position: relative;
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--hairline);
  transition:
    background 0.25s,
    transform 0.25s;
}
.dot span {
  position: absolute;
  right: calc(100% + 0.6rem);
  top: 50%;
  transform: translateY(-50%);
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.dot:hover span {
  opacity: 1;
}
.dot.is-active {
  transform: scale(1.45);
}
.dot.is-active[data-target="bio"] {
  background: var(--accent-bio);
}
.dot.is-active[data-target="gallery"] {
  background: var(--accent-gallery);
}
.dot.is-active[data-target="media"] {
  background: var(--accent-writings);
}
.dot.is-active[data-target="books"] {
  background: var(--accent-books);
}
.dot.is-active[data-target="contacts"] {
  background: var(--accent-contacts);
}

@media (max-width: 720px) {
  .dots {
    right: 0.75rem;
  }
  .dot span {
    display: none;
  }
}

/* ============================================================
   01 · BIO
   ============================================================ */
.bio {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
.bio__portrait {
  margin: 0;
}
.bio__portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
}
.bio__portrait figcaption {
  margin-top: 0.6rem;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bio__name {
  font-size: var(--fs-name);
  letter-spacing: -0.02em;
  transition: font-size 0.2s;
}
.bio__role {
  margin: 0.2rem 0 1.4rem;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bio);
}
.prose {
  max-width: 60ch;
  color: var(--ink-soft);
}
.prose + .prose {
  margin-top: 1rem;
}

.wiki {
  color: var(--muted);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
}

.awards {
  margin-top: clamp(1.25rem, 3vh, 2rem);
}
/* On windows wider than 480px, push the awards block to the bottom of the
   bio section so the layout breathes. */
@media (min-width: 481px) {
  .screen--bio .awards {
    margin-top: auto;
  }
}
.awards__title {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.awards__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}
.awards__list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding-block: 0.15rem;
}
.awards__year {
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-weight: 700;
  color: var(--accent-bio);
}

@media (max-width: 720px) {
  .bio {
    grid-template-columns: 1fr;
    justify-content: center;
  }
  .bio__portrait {
    justify-self: center;
  }
  .bio__portrait img {
    max-width: 240px;
  }
  .awards__list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ============================================================
   02 · GALLERY
   ============================================================ */
/* The gallery content stacks a fixed-height thumb strip on top and the
   hero image below. On widths < 720px the strip is hidden and the arrows
   move to flank the hero instead (see media query at the end of the file). */
.gallery {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 20px; /* fixed gap between thumbs strip and hero row */
  min-height: 0;
}
/* Gallery screen: leave 60px clear above the screen bottom so the hero row
   doesn't touch it on short viewports. */
.screen--gallery .screen__inner {
  padding-bottom: 60px;
}
.gallery__striprow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.gallery__herorow {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 0;
}

/* Strip: fixed 96px tall, horizontally scrollable, never shrinks */
.thumbs {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 96px; /* fixed height — always visible */
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px;
  margin: 0;
}
.thumbs::-webkit-scrollbar {
  height: 5px;
}
.thumbs::-webkit-scrollbar-thumb {
  background: var(--hairline);
  border-radius: 3px;
}

.thumb {
  flex: 0 0 96px; /* fixed 96×96 thumbnails */
  width: 96px;
  height: 88px;
  padding: 0;
  background: none;
  border: none;
  opacity: 0.6;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.thumb img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--hairline);
}
.thumb:hover {
  opacity: 1;
}
.thumb.is-active {
  opacity: 1;
}
.thumb.is-active img {
  outline: 2px solid var(--accent-gallery);
  outline-offset: 2px;
}

/* Side arrows (shared by strip row and hero row) */
.gnav {
  flex: 0 0 auto;
  width: 2rem;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 1.5rem;
  line-height: 1;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s;
  user-select: none;
}
.gnav:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.gnav:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
/* In the hero row the arrows flank the image; make them a touch narrower */
.gallery__herorow .gnav {
  height: 3rem;
}
/* Hero-row arrows are hidden on wide screens; shown only on narrow ones */
.gallery__herorow .gnav {
  display: none;
}

.hero {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.hero__canvas {
  display: block;
  width: 100%;
  background: var(--paper-2);
  /*border: 1px solid var(--hairline);*/
  cursor: zoom-in;
  transition: opacity 0.25s ease;
  -webkit-user-drag: none;
  user-select: none;
  padding: 20px 24px;
}
.hero__canvas.is-loading {
  opacity: 0;
}
.hero figcaption {
  display: none;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.75rem;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
}
.hero figcaption span:first-child {
  font-size: 1.05rem;
  color: var(--ink);
}
.hero__year {
  color: var(--accent-gallery);
  font-weight: 700;
}
.counter-line {
  margin-top: 0.5rem;
  color: var(--muted);
  font-style: italic;
}

/* Narrow screens (< 720px): hide the thumb strip (and its arrows), show
   the hero-row arrows to walk paintings instead. */
@media (max-width: 480px) {
  .gallery__striprow {
    display: none;
  }
  .gallery__herorow .gnav {
    display: flex;
  }
}

/* ============================================================
   03 · WRITINGS
   ============================================================ */
/* ============================================================
   03 · MEDIA
   ============================================================ */
.media-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
/* In the grid, drop the top spacing the blocks used as standalone sections */
.media-grid .media,
.media-grid .videos {
  margin-top: 0;
}

.card {
  margin: 0;
}
.card--articles {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
}
.card__counter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.count {
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-weight: 700;
  font-size: clamp(4rem, 2rem + 8vw, 6.5rem);
  line-height: 0.9;
  color: var(--accent-writings);
}
.card__label {
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.5rem;
  max-width: 14ch;
}
.card__media {
  margin: 0;
}
.card__media img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--hairline);
}
.card__note {
  margin-top: 0.75rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

.card--book {
  display: flex;
  flex-direction: column;
}
.card--book .card__media {
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
}
.card--book .card__body {
  margin-top: 1rem;
  text-align: center;
}
.card__title {
  font-size: 1.4rem;
  color: var(--accent-writings);
}
.card__meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-style: italic;
}

.media {
  margin-top: clamp(2.5rem, 6vh, 4rem);
}
.media__title {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.media__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
  max-width: 64ch;
}
.media__list a {
  display: block;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--hairline);
  transition:
    color 0.2s,
    padding-left 0.2s;
}
.media__list a:hover {
  color: var(--accent-writings);
  padding-left: 0.4rem;
}

@media (max-width: 760px) {
  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   03b · VIDEOS — vertical list of 280px video thumbnails
   (sits in the right column of the Media grid)
   ============================================================ */
.videos {
  margin-top: clamp(2.5rem, 6vh, 4rem);
}
.videos__title {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.videos__list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}
.video {
  width: 280px;
  max-width: 100%;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}
.video:hover {
  color: var(--accent-writings);
}
.video__thumb {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--hairline);
  transition:
    border-color 0.2s,
    transform 0.2s;
  background: var(--paper-2);
}
.video:hover .video__thumb {
  border-color: var(--accent-writings);
  transform: scale(1.02);
}
.video__media {
  position: relative;
  display: block;
  width: 100%;
  max-width: 280px;
}
.video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  display: block;
  pointer-events: none;
  opacity: 0.7;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.video__title {
  display: block;
  margin-bottom: 0.5rem;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: inherit;
  line-height: 1.3;
  color: #f00;
  text-decoration: underline;
}

/* ============================================================
   04 · BOOKS — horizontal grid of book cards (adaptive)
   ============================================================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}
/* In the books grid the cover fills the (adaptive) cell width */
.books-grid .card--book .card__media {
  max-width: 100%;
}
/* Books screen uses its own accent for the titles */
.screen--books .card__title {
  color: var(--accent-books);
}
@media (max-width: 760px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   05 · CONTACTS
   ============================================================ */
.contact__lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.contact__links {
  color: var(--ink);
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  display: flex;
  flex-flow: row nowrap;
  gap: 4rem;
}
.contact__link {
  color: var(--accent-contacts);
}

.contact__sig {
  margin-top: 4rem;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.04em;
}

/* ============================================================
   Lightbox — full-screen popup, black background, × close button.
   The image is drawn on a <canvas> (no <img> in the DOM).
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;
}
.lightbox[hidden] {
  display: none;
}
.lightbox__close {
  position: absolute;
  top: 8px;
  right: 16px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #fff;
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  -webkit-user-select: none;
  user-select: none;
  transition:
    color 0.2s,
    transform 0.2s;
}
.lightbox__close:hover {
  color: #ddd;
  transform: scale(1.08);
}
.lightbox__close:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 2px;
}
.lightbox__canvas {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
  user-select: none;
}

/* Block dragging / selecting the images generally */
img,
canvas {
  -webkit-user-drag: none;
  user-select: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }
  * {
    transition: none !important;
  }
}
