:root {
  --bg: #f6f5f2;
  --text: #111;
  --line: #cccccc;
}

@font-face {
  font-family: "GT Super Display";
  src: url("./assets/fonts/GT-Super-Display-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica Neue Cyr Medium";
  src: url("/assets/fonts/HelveticaNeueCyr-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica Neue Cyr Roman";
  src: url("/assets/fonts/HelveticaNeueCyr-Roman.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
}

body {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.top-nav {
  position: fixed;
  top: 32px;
  left: 32px;
  right: 32px;
  display: flex;
  justify-content: space-between;
  z-index: 1000;
  font-size: 20px;
  line-height: 1.4;
  text-transform: none;
  background: transparent;
  color: #fff;
  /* Difference inverts white text against the backdrop:
     light sections -> dark text, dark sections -> light text. */
  mix-blend-mode: difference;
  /* Let clicks pass through empty header area to underlying content. */
  pointer-events: none;
}

.top-nav a {
  /* Keep nav links interactive while container remains click-through. */
  pointer-events: auto;
}

.menu-left,
.menu-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-right {
  align-items: flex-end;
  text-align: right;
}

.gray:hover {
    mix-blend-mode: normal;
    color: #808080;
}

.page {
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* CSS-first section snapping with smooth transitions between snap points. */
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.page > section {
  min-height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Treat each project card as a snap step within the works flow. */
.works .case-item {
  min-height: 640px;
  /* Disable snap animation for works cards. */
  scroll-snap-align: none;
  scroll-snap-stop: normal;
}

.hero {
  min-height: 100vh;
  padding: 100px 28px 0;
  display: grid;
  /* Row 1 holds visual content, row 2 anchors the title at section bottom. */
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 0px;
}

.avatar {
  width: 288px;
  height: 360px;
  object-fit: cover;
}

h1,
h2 {
  margin: 0;
  text-align: center;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

h1 {
  /* Keep the intended viewport gutter without exceeding the hero content box. */
  width: 100%;
  max-width: 100%;
  /* Fluid scaling with min/max caps for readability on very small/large screens. */
  font-size: clamp(36px, calc((100vw - 48px) / 6), 260px);
  line-height: 0.95;
  letter-spacing: -0.015em;
  white-space: nowrap;
  font-family: "GT Super Display", "Playfair Display", Georgia, serif;
  font-weight: 700;
}

@media (min-width: 1025px) and (max-width: 1680px) {
  h1 {
    /* Prevent right-side clipping for this viewport band. */
    font-size: calc((100vw - 128px) / 6)
  }
}

.about {
  max-width: 1168px;
  margin: 0 auto;
  padding: 90px 32px 124px;
  display: flex;
  /* Center second-section content both vertically and horizontally. */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.about h2 {
  /* Keep the intro statement constrained while centered. */
  max-width: 1168px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(36px, 6vw, 80px);
  line-height: 1.05;
  margin-bottom: 108px;
}

.about p {
  /* Secondary intro copy follows the 756px measure for readability. */
  max-width: 756px;
  margin: 0 auto 16px;
  text-transform: uppercase;
  font-size: 20px;
  line-height: 1.4;
}

.works {
  border-top: 1px solid var(--line);
}

.case-item {
  display: grid;
  grid-template-columns: minmax(320px, 800px) 1fr;
  gap: 32px;
  height: 640px;
  min-height: 640px;
}

.down {
    border-bottom: 1px solid var(--line);
}

.case-item-link {
  position: relative;
}

.case-overlay-link {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.case-media {
  border-right: 1px solid var(--line);
  display: grid;
  place-items: center;
  padding: 32px;
}

.case-media img {
  max-width: 100%;
  max-height: 510px;
  object-fit: contain;
}

.case-copy {
  position: relative;
  padding: 42px 32px 42px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 20px;
  line-height: 1.4;
}

.case-copy > div,
.case-copy .year {
  /* Scope custom medium font + uppercase to all project meta lines (including year). */
  font-family: "Helvetica Neue Cyr Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-transform: uppercase;
}

.case-copy > div {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.case-copy h3,
.case-copy p {
  margin: 0;
}

.case-copy > p {
  max-width: 736px;
  font-family: "Helvetica Neue Cyr Roman", "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-transform: uppercase;
}

.works .case-copy h3 {
  /* Keep semantic heading markup, but render it with paragraph styling. */
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.skills {
  padding: 120px 32px;
  text-align: center;
  /* Disable snap only here so this section scrolls with native behavior. */
  scroll-snap-align: none;
  scroll-snap-stop: normal;
}

.skills p {
  margin: 0 0 28px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(34px, 5vw, 80px);
  line-height: 0.95;
  text-transform: lowercase;
}

.skills .note {
  max-width: 756px;
  margin: 80px auto 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.4;
  text-transform: uppercase;
}

.contact {
  min-height: 100vh;
  padding: 336px 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
}

.contact h2 {
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1.05;
}

.contact h2 span {
  color: rgba(0, 0, 0, 0.5);
}

.contact-email-link {
  color: rgba(0, 0, 0, 0.5);
  transition: color 0.2s ease;
}

.contact-email-link:hover {
  color: #000000;
}

.contact p {
  margin-top: auto;
  margin-bottom: 0;
  text-transform: uppercase;
  font-size: 20px;
  line-height: 1.4;
}

@media (min-width: 1025px) {
  .works {
    --stack-top: 0px;
    --stack-shift: 16px;
    --stack-scale-step: 0.04;
  }

  .works.works--stack {
    position: relative;
    isolation: isolate;
    border-top: 0;
  }

  .works.works--stack .case-item {
    position: sticky;
    top: var(--stack-top);
    z-index: var(--stack-z, 1);
    background: var(--bg);
    border-top: 1px solid var(--line);
    transform-origin: 50% 7%;
    transform: translate3d(0, var(--stack-translate, 0), 0) scale(var(--stack-scale, 1));
    opacity: var(--stack-opacity, 1);
    will-change: transform, opacity;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .page {
    /* Proximity feels less rigid on touch devices while preserving snapping. */
    scroll-snap-type: y proximity;
  }

  .page > section,
  .works .case-item {
    scroll-snap-stop: normal;
  }

  .top-nav {
    top: 24px;
    left: 20px;
    right: 20px;
    font-size: 20px;
    line-height: 1.4;
  }

  .hero {
    min-height: 100vh;
    padding: 120px 16px 0;
  }

  .avatar {
    width: 200px;
    height: 250px;
  }

  h1 {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    font-size: calc((100vw - 96px) / 6);
    line-height: 0.9;
    white-space: nowrap;
  }

  .about,
  .skills,
  .contact {
    padding-left: 20px;
    padding-right: 20px;
  }

  .about p,
  .skills .note,
  .case-copy,
  .contact p {
    font-size: 14px;
  }

  .case-item {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    gap: 0;
    border-bottom: 0;
  }

  .works {
    border-top: 0;
    padding: 0 24px;
    display: grid;
    gap: 80px;
  }

  .case-media {
    border-right: 0;
    border-bottom: 0;
    height: 400px;
    padding: 0;
  }

  .case-copy {
    padding: 0;
    gap: 0;
    align-items: center;
    text-align: center;
  }

  .case-media img {
    width: auto;
    max-width: 100%;
    height: 400px;
    object-fit: contain;
  }

}

@media (max-width: 767px) {
  body {
    overflow: auto;
  }

  .top-nav {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin: 32px 16px 0;
    display: flex;
    justify-content: flex-start;
    gap: 75px;
    font-size: 16px;
    line-height: 24px;
    mix-blend-mode: normal;
    color: var(--text);
    pointer-events: auto;
  }

  .menu-left,
  .menu-right {
    gap: 0;
    align-items: flex-start;
    text-align: left;
  }

  .page {
    height: auto;
    overflow: visible;
    scroll-snap-type: none;
  }

  .page > section {
    min-height: auto;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
  }

  .hero {
    min-height: auto;
    padding: 60px 16px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .avatar {
    width: 208px;
    height: 260px;
    object-fit: cover;
    justify-self: start;
    align-self: start;
  }

  h1 {
    width: 236px;
    max-width: 236px;
    font-size: 56px;
    line-height: 0.8;
    white-space: normal;
    text-wrap: balance;
    text-align: left;
    justify-self: start;
  }

  .about {
    min-height: auto;
    margin-top: 280px;
    padding: 0 16px;
  }

  .about h2 {
    max-width: 100%;
    font-size: 36px;
    line-height: 32px;
    margin-bottom: 48px;
  }

  .about p {
    max-width: 100%;
    font-size: 14px;
    line-height: 16px;
  }

  .works {
    margin-top: 80px;
    padding: 0 16px;
    border-top: 0;
    display: grid;
    gap: 80px;
  }

  .works .case-item {
    min-height: auto;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
  }

  .case-item {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    gap: 24px;
    border-bottom: 0;
    align-items: start;
  }

  .case-item.case-item-gap-16 {
    gap: 16px;
  }

  .case-media {
    width: 100%;
    max-width: 328px;
    height: 208px;
    margin: 0 auto;
    border: 0;
    padding: 0;
    display: grid;
    place-items: center;
  }

  .case-media img {
    width: auto;
    max-width: 100%;
    height: 208px;
    object-fit: contain;
  }

  .case-copy {
    width: 100%;
    max-width: 328px;
    margin: 0 auto;
    padding: 0;
    gap: 0;
    font-size: 14px;
    line-height: 16px;
    text-align: center;
    align-items: center;
    justify-content: flex-start;
  }

  .case-copy > div {
    align-items: center;
  }

  .case-copy > div p,
  .case-copy > p {
    display: none;
  }

  .case-copy h3 {
    font-size: 14px;
    line-height: 16px;
    text-transform: uppercase;
  }

  .skills {
    min-height: auto;
    margin-top: 80px;
    padding: 0 16px;
  }

  .skills p {
    margin-bottom: 48px;
    font-size: 36px;
    line-height: 32px;
  }

  .skills .note {
    margin-top: 0;
    max-width: 100%;
    font-size: 14px;
    line-height: 16px;
  }

  .contact {
    min-height: 100vh;
    padding: 284px 16px 24px;
    justify-content: flex-start;
    gap: 0;
  }

  .contact h2 {
    font-size: 36px;
    line-height: 32px;
    margin: 0;
  }

  .contact h2 span {
    display: block;
    margin-top: 0;
  }

  .contact p {
    font-size: 16px;
    line-height: 24px;
    margin-top: 284px;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Respect accessibility settings: keep native scrolling behavior. */
  .page {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  .page > section,
  .works .case-item {
    scroll-snap-align: none;
    scroll-snap-stop: normal;
  }
}
