/* Author's stories use the existing type, spacing and background tokens. */
/* Irkutsk: a consistent presentation frame; drawings stay uncropped. */
.story-uniform .story-cover { width:100%; max-width:none; margin-inline:0; }
.story-uniform .story-gallery > figure { width:100%; max-width:none; }
.story-uniform .story-gallery .story-image { aspect-ratio:16 / 9; overflow:hidden; background:var(--color-white); }
.story-uniform .story-gallery .story-image img { width:100%; height:100%; max-height:none; max-width:none; object-fit:cover; }
.story-uniform .story-gallery .story-plan img { object-fit:contain; }
.story-head { padding-block: calc(var(--spacing) * 6) calc(var(--spacing) * 8); }
.story-head > .inner, .story-section > .inner { max-width: var(--container); padding-inline: var(--spacing-gutter); margin-inline: auto; }
.story-overline { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.story-overline .back { margin: 0; }
.story-index, .story-section-number { font-size: var(--text-small); font-variant-numeric: tabular-nums; color: var(--fg-muted); letter-spacing: var(--tracking-wide); }
.story-title { font-size: clamp(2.75rem, 1rem + 6.5vw, 7.75rem); font-weight: 300; line-height: .98; letter-spacing: -.035em; text-wrap: balance; margin: calc(var(--spacing) * 6) 0 0 -.089em; overflow-wrap: normal; }
.story-rating { display: block; font-size: .24em; line-height: 1.4; margin-bottom: .6em; letter-spacing: 0; }
/* Round 2: preserve portrait compositions and give selected work room. */
.xp .xp-1 figure { aspect-ratio:16 / 9; }
.xp .xp-2 figure { aspect-ratio:16 / 10; }
.xp .xp-3 figure { aspect-ratio:3 / 4; }
.xp .xp-4 figure { aspect-ratio:16 / 9; }
.xp .t-h3 { text-wrap:balance; }
.xp > a:focus-visible { outline:2px solid currentColor; outline-offset:8px; }
@media(min-width:1000px) {
  .xp .xp-1 { grid-column:1 / -1; }
  .xp .xp-1 .t-h3 { font-size:clamp(2rem, 3.5vw, 4rem); font-weight:300; letter-spacing:-.035em; }
  .xp .xp-2 { grid-column:1 / 9; align-self:start; }
  .xp .xp-3 { grid-column:9 / 13; }
  .xp .xp-4 { grid-column:1 / 9; margin-top:0; }
}
@media(max-width:699px) {
  .xp-head { flex-wrap:wrap; gap:1rem; }
  .xp .xp-1 figure, .xp .xp-2 figure { aspect-ratio:4 / 3; }
  .xp .xp-3 figure { aspect-ratio:4 / 5; }
}
.story-specs { margin-top: calc(var(--spacing) * 5); max-width: 90ch; white-space: pre-wrap; }
.story-open-gallery { margin-top: 1.5rem; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: inherit; padding: .5rem 0; font: inherit; cursor: pointer; }
@media (hover:hover) { .story-open-gallery:hover { opacity: .7; } }
.story-open-gallery:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
.story-cover { margin: 0; background: var(--color-white); }
.story-cover .story-image { overflow:hidden; max-height:none; }
.story-cover .story-image img { display:block; width:100%; height:auto; max-width:none; max-height:none; object-fit:cover; }
.story-cover.is-portrait .story-image { aspect-ratio:16 / 9; }
.story-cover.is-portrait .story-image img { height:100%; }
.story-cover.is-portrait .story-image img { object-position:50% 88%; }
/* The pool master has a thin dark export edge along its bottom. */
.story-cover .story-image:has(> img[src*="5c5569aa75de"]) { clip-path:inset(0 0 3px); margin-bottom:-3px; }
.story-gallery > .story-landscape { width:100%; max-width:none; }
.story-cover figcaption { margin: 0; max-width: none; padding: 1rem var(--spacing-gutter); display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem 2rem; font-size: var(--text-small); color: var(--color-gray); }
@media(max-width:699px) {
  .story-cover.is-portrait .story-image { aspect-ratio:4 / 3; }
}
.story-enlarge { opacity: .75; }
.story-status { border-left: 1px solid currentColor; padding-left: 1rem; }
.story-section, .story-section + .story-section { padding-block: clamp(3.5rem, 6vw, 6rem); }
.story-reading { display: grid; gap: calc(var(--spacing) * 3); }
.story-copy { width: 100%; max-width: 50rem; min-width: 0; }
.story-copy p { font-size: 1.125rem; line-height: 1.65; white-space: pre-wrap; hyphens: manual; }
.story-copy > p + p { margin-top: 1.5em; }
.story-copy p.story-opening { font-size: clamp(1.25rem, 1rem + .7vw, 1.6rem); line-height: 1.5; hyphens: none; }
.story-copy p.story-final { font-size: clamp(1.4rem, 1rem + 1.3vw, 2.2rem); line-height: 1.35; letter-spacing: -.015em; hyphens: none; }
.story-gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 5rem); margin-block: clamp(3rem, 6vw, 6rem) 0; }
.story-gallery figure { margin: 0; min-width: 0; }
.story-portrait { width:100%; min-width:0; }
.story-editorial { display:grid; gap:2rem; }
.story-editorial-photo { margin:0; }
.story-editorial-photo figcaption { margin-top:.875rem; color:var(--fg-muted); font-size:1rem; line-height:1.5; }
.story-diptych { display:grid; grid-template-columns:minmax(0,1fr); gap:2.5rem; }
@media(min-width:700px) {
  .story-diptych { grid-template-columns:var(--portrait-columns,1fr 1fr); gap:var(--grid-gap); align-items:start; }
}
@media(min-width:900px) {
  .story-editorial { grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); gap:clamp(2rem,5vw,5rem); align-items:center; }
  .story-editorial .story-reading { display:block; }
  .story-editorial .story-section-number { display:block; margin-bottom:1.5rem; }
  .story-editorial .story-copy { max-width:none; }
}
.story-image { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: transparent; color: inherit; }
.story-image img { display: block; width: 100%; height: auto; }
.story-gallery figcaption { font-size: 1rem; line-height: 1.5; margin-top: .875rem; color: var(--fg-muted); }
.story-gallery .story-plan { grid-column: 1 / -1; }
.story-plan img { max-height: 80svh; object-fit: contain; background: var(--color-white); }
.story-image:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
.story-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 0; border: 0; background: var(--color-graphite); color: var(--color-white); }
.story-viewer::backdrop { background: var(--color-graphite); }
.story-viewer[open] { display: flex; flex-direction: column; }
.story-viewer-toolbar { position: relative; z-index: 1; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; padding: 1rem; flex-shrink: 0; background: var(--color-graphite); }
.story-viewer-toolbar button { font: inherit; color: inherit; background: transparent; border: 1px solid currentColor; padding: .5rem 1rem; cursor: pointer; }
.story-viewer-toolbar a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; border: 1px solid currentColor; padding: .5rem 1rem; }
.story-viewer-toolbar button:disabled { opacity: .35; cursor: default; }
@media (max-width:1199px) {
  .story-viewer-toolbar button,
  .story-viewer-toolbar a { min-width:48px; min-height:48px; }
  .story-viewer-toolbar a { display:inline-flex; align-items:center; }
}
.story-viewer-count { margin-left: auto; font-variant-numeric: tabular-nums; }
html.story-viewing, html.story-viewing body { overflow: hidden; }
.story-viewer-stage { overflow: auto; flex: 1; min-height: 0; display: grid; align-items: center; justify-items: center; overscroll-behavior: contain; }
.story-viewer-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.story-viewer-stage.is-zoomed { display: block; }
.story-viewer-stage.is-zoomed img { max-width: none; max-height: none; margin: auto; width: auto; height: auto; }
.story-viewer-stage { touch-action: pan-y; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.story-viewer-stage:not(.is-zoomed) > img { width: 100%; height: 100%; object-fit: contain; }
.story-viewer-stage.is-zoomed { touch-action: auto; cursor: grab; }
.story-viewer-stage.is-dragging { cursor: grabbing; user-select: none; }
.story-viewer-stage img { cursor: zoom-in; }
.story-viewer-stage.is-zoomed img { cursor: inherit; }
.story-viewer-status { min-height: 1.5rem; padding-inline: 1rem; font-size: .875rem; color: var(--color-white); }
.story-viewer-status button { color: inherit; background: transparent; border: 0; text-decoration: underline; cursor: pointer; font: inherit; }
.story-viewer-details { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: .75rem 1rem; flex-shrink: 0; }
.story-viewer-caption { margin: 0; font-size: 1rem; line-height: 1.4; }
.story-viewer-hint { font-size: .75rem; opacity: .7; }
.story-viewer-thumbs { display: flex; flex-shrink: 0; gap: .6rem; padding: .25rem 1rem 1rem; overflow-x: auto; overscroll-behavior: contain; }
.story-viewer-thumbs button { flex: 0 0 5rem; height: 3.75rem; padding: 3px; border: 1px solid transparent; background: transparent; opacity: .55; cursor: pointer; }
.story-viewer-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--color-white); }
@media (hover:hover) { .story-viewer-thumbs button:hover { opacity: 1; } }
.story-viewer-thumbs button:focus-visible { opacity: 1; }
.story-viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-viewer button:focus-visible, .story-viewer a:focus-visible { outline: 2px solid white; outline-offset: 2px; }
@media(max-width:699px) {
  .story-viewer-hint { display: none; }
  .story-viewer-details { padding: .5rem .75rem; }
  .story-viewer-caption { font-size: .875rem; }
  .story-viewer-thumbs { padding: .25rem .75rem .75rem; }
  .story-viewer-thumbs button { flex-basis: 4rem; height: 3rem; }
}
.story-next-link { display: grid; align-items: center; gap: 3rem; color: inherit; text-decoration: none; }
.story-next-link h2 { font-size: clamp(2rem, 1rem + 3vw, 4rem); font-weight: 300; line-height: 1.1; letter-spacing: -.025em; margin-top: 1.5rem; text-wrap: balance; }
.story-next-link figure { margin: 0; overflow: hidden; }
.story-next-link img { display: block; width: 100%; max-width:none; margin-inline:auto; height:auto; }
.story-next-link .story-next-portrait { width:100%; max-width:none; margin-inline:0; }
.xl-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; }
.xl-total { display: none; } /* число проектов уже есть в навигации по разделам */
.catalog-grid { padding-bottom: var(--spacing-section); }
.catalog-grid figure { position: relative; }
.catalog-arrow { position: absolute; right: 1.25rem; bottom: 1.25rem; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; background: var(--color-white); color: var(--color-black); font-size: 1.5rem; opacity: 0; transform: translateY(.5rem); transition: opacity .3s, transform .3s var(--ease); }
.xg-card:hover .catalog-arrow, .xg-card:focus-visible .catalog-arrow { opacity: 1; transform: none; }
.catalog-status { display: block; font-size: var(--text-small); color: var(--fg-muted); margin-top: .75rem; }
/* Content stays visible without JS. Only armed elements animate. */
@media (prefers-reduced-motion: no-preference) {
  [data-motion].motion-ready { opacity: 0; transform: translateY(1.5rem); transition: opacity .8s var(--ease), transform 1s var(--ease); }
  [data-motion].motion-ready.motion-visible { opacity: 1; transform: none; }
  .story-cover.motion-ready { transform: none; clip-path: inset(0 0 8% 0); transition: opacity .9s var(--ease), clip-path 1.3s var(--ease); }
  .story-cover.motion-visible { clip-path: inset(0); }
}
@media (min-width: 1000px) {
  .story-reading { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--grid-gap); }
  .story-section-number { grid-column: 1 / 3; padding-top: .4rem; }
  .story-copy { grid-column: 3 / 12; }
  .story-next-link { grid-template-columns:minmax(0,1fr); gap:2rem; }
}
@media (max-width: 699px) {
  .story-copy p { font-size: 1.0625rem; }
  .story-cover img { aspect-ratio:auto; max-height: none; }
  .story-cover figcaption { justify-content: flex-start; }
  .story-enlarge { display: none; }
  .story-title { font-size: clamp(2.5rem, 10.5vw, 4.5rem); }
  .story-section-number { border-top: 1px solid var(--rule); padding-top: 1rem; }
  .story-next-link { gap: 2rem; }
  .catalog-arrow { opacity: 1; transform: none; }
  .story-viewer-toolbar { gap: .6rem; padding: .75rem; font-size: .8125rem; }
  .story-viewer-toolbar button, .story-viewer-toolbar a { padding: .5rem .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .story-image img, .story-next-link img, .catalog-arrow { animation: none; transition: none; }
}
/* Short phones: keep actions beside the image instead of stacking above it. */
@media (orientation:landscape) and (max-height:500px) and (min-width:480px) {
  .story-viewer[open] { display:grid; grid-template-columns:152px minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto auto; }
  .story-viewer-toolbar { grid-column:1; grid-row:1 / -1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; gap:.5rem; padding:.5rem; overflow-y:auto; font-size:.8125rem; }
  .story-viewer-toolbar [data-close],
  .story-viewer-toolbar [data-zoom],
  .story-viewer-toolbar a,
  .story-viewer-count { grid-column:1 / -1; }
  .story-viewer-count { margin:0; text-align:center; }
  .story-viewer-toolbar a { justify-content:center; padding-inline:.25rem; }
  .story-viewer-stage { grid-column:2; grid-row:1; }
  .story-viewer-status { grid-column:2; grid-row:2; min-height:0; padding:.25rem .75rem; }
  .story-viewer-status:empty { display:none; }
  .story-viewer-details { grid-column:2; grid-row:3; min-height:0; max-height:5rem; padding:.5rem .75rem; overflow-y:auto; }
  .story-viewer-hint, .story-viewer-thumbs { display:none; }
}
@media(min-width:900px) {
  .story-next-link:has(.story-next-portrait) { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(2rem,5vw,5rem); }
  .story-next-link:has(.story-next-portrait) .project-facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
