
:root {
  --touch-min: 2.75rem;
  --nav-h: clamp(3.75rem, 9vh, 5.25rem);
  --hero-block-h: calc(100svh - var(--nav-h));
}

@supports not (height: 100svh) {
  :root {
    --hero-block-h: calc(100vh - var(--nav-h));
  }
}

/* ---- Post-hero sections: centered 1200px canvas with side gutters ---- */
main > .section {
  width: 100%;
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .exp-scrap {
    width: min(920px, 96%);
  }

  .exp-scrap--left {
    align-self: flex-start;
    margin-left: clamp(0rem, 3vw, 2.5rem);
    margin-right: auto;
  }

  .exp-scrap--right {
    align-self: flex-end;
    margin-right: clamp(0rem, 3vw, 2.5rem);
    margin-left: auto;
  }
}

/* ---- Laptop+ (1024px): desktop nav + viewport-fit hero ---- */
@media (min-width: 1024px) {
  :root {
    --fs-root: clamp(0.9375rem, 0.82rem + 0.35vw, 1.0625rem);
    --fs-hero-name: clamp(2.35rem, 1.1rem + 3vw + 0.55vh, 4.25rem);
    --fs-hero-eyebrow: clamp(0.9375rem, 0.72rem + 0.5vw + 0.28vh, 1.375rem);
    --fs-hero-role: clamp(0.9375rem, 0.75rem + 0.45vw + 0.22vh, 1.375rem);
    --fs-hero-skill: clamp(0.625rem, 0.54rem + 0.18vw + 0.1vh, 0.875rem);
    --fs-hero-win: clamp(0.75rem, 0.68rem + 0.14vw + 0.08vh, 1rem);
    --fs-btn: clamp(0.75rem, 0.68rem + 0.18vw, 0.9375rem);
    --content-max: 100%;
    --portrait-max: clamp(240px, 28vw, 580px);
  }

  .site-nav__toggle {
    display: none;
  }

  .site-nav__menu {
    position: static;
    display: flex;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 42vw);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    column-gap: clamp(0.5rem, 1.25vw, 1rem);
    row-gap: 0;
    min-height: var(--hero-block-h);
    max-height: var(--hero-block-h);
    height: var(--hero-block-h);
    padding-top: clamp(0.35rem, 0.9vh, 0.75rem);
    padding-bottom: clamp(0.35rem, 0.9vh, 0.75rem);
    padding-left: max(calc(var(--gutter) + clamp(0.85rem, 2vw, 1.85rem)), env(safe-area-inset-left, 0px));
    padding-right: 0;
    gap: 0;
    overflow: clip;
  }

  .hero__layout {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    justify-self: start;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    height: 100%;
    max-height: 100%;
    padding: 0;
    text-align: left;
  }

  .hero__text {
    flex: 0 0 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    padding-top: clamp(1.25rem, 3vh, 2rem);
    padding-bottom: 0;
  }

  .hero__eyebrow,
  .hero__title,
  .hero__lines,
  .hero__wins,
  .hero__actions {
    margin-left: clamp(0.5rem, 1.15vw, 1.05rem);
  }

  .hero__eyebrow {
    margin-top: clamp(3.25rem, 7vh, 4.75rem);
  }

  .hero__title {
    margin-top: clamp(0.35rem, 0.9vh, 0.65rem);
    padding-bottom: clamp(0.45rem, 1.1vh, 0.9rem);
  }

  .hero__line--indent {
    margin-left: clamp(0.85rem, 3vw, 1.85rem);
  }

  .hero__lines {
    margin-top: clamp(0.75rem, 1.6vh, 1.1rem);
    max-width: 100%;
  }

  .hero__eyebrow,
  .hero__actions {
    max-width: 100%;
  }

  .hero__skills {
    margin-top: clamp(1rem, 2.4vh, 1.65rem);
    gap: clamp(0.35rem, 0.65vw, 0.55rem);
  }

  .hero__skill {
    padding: 0.35em 0.65em;
  }

  .hero__wins {
    flex: 0 0 auto;
    align-self: flex-start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.5rem, 1.2vh, 0.85rem) clamp(0.5rem, 1vw, 0.8rem);
    margin-top: auto;
    margin-bottom: auto;
    width: auto;
    max-width: 100%;
  }

  .hero__win {
    padding: clamp(0.55rem, 1.1vh, 0.8rem) clamp(0.7rem, 1.2vw, 0.95rem);
  }

  .hero__win-medal {
    font-size: clamp(1.1rem, 0.85rem + 0.6vw + 0.15vh, 1.45rem);
  }

  .hero__actions {
    flex: 0 0 auto;
    margin-top: 0;
    margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
    padding-top: 0;
    flex-shrink: 0;
    max-width: 100%;
  }
   

  .hero__btn {
    min-height: clamp(2rem, 1.65rem + 0.9vh, 2.35rem);
    padding: 0.45rem 1rem;
  }

  .hero__portrait {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
    align-self: stretch;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: contain;
    object-position: right bottom;
  }

  svg.sketchpad__art {
    -webkit-mask-image: radial-gradient(
      ellipse 95% 108% at 92% 52%,
      #000 30%,
      rgba(0, 0, 0, 0.92) 44%,
      rgba(0, 0, 0, 0.72) 56%,
      rgba(0, 0, 0, 0.48) 68%,
      rgba(0, 0, 0, 0.22) 80%,
      rgba(0, 0, 0, 0.08) 90%,
      transparent 98%
    );
    mask-image: radial-gradient(
      ellipse 95% 108% at 92% 52%,
      #000 30%,
      rgba(0, 0, 0, 0.92) 44%,
      rgba(0, 0, 0, 0.72) 56%,
      rgba(0, 0, 0, 0.48) 68%,
      rgba(0, 0, 0, 0.22) 80%,
      rgba(0, 0, 0, 0.08) 90%,
      transparent 98%
    );
  }
}

/* Short laptop viewports — scale down only when truly tight */
@media (min-width: 1024px) and (max-height: 780px) {
  :root {
    --fs-hero-name: clamp(1.85rem, 0.9rem + 2vw + 0.5vh, 3.25rem);
    --fs-hero-eyebrow: clamp(0.8125rem, 0.65rem + 0.3vw + 0.2vh, 1.0625rem);
    --fs-hero-role: clamp(0.8125rem, 0.68rem + 0.25vw + 0.16vh, 1.0625rem);
    --fs-hero-win: clamp(0.6875rem, 0.62rem + 0.1vw + 0.06vh, 0.875rem);
    --portrait-max: clamp(200px, 26vw, 480px);
  }

  .hero__title {
    padding-bottom: clamp(0.35rem, 0.8vh, 0.65rem);
  }

  .hero__wins {
    gap: clamp(0.35rem, 0.9vh, 0.6rem) clamp(0.4rem, 0.8vw, 0.6rem);
  }

  .hero__win {
    padding: 0.45rem 0.7rem;
  }

  .hero__portrait {
    height: 100%;
    max-height: none;
  }
}

@media (min-width: 1024px) and (max-height: 680px) {
  :root {
    --fs-hero-name: clamp(1.45rem, 0.65rem + 1.2vw + 0.5vh, 2.5rem);
    --fs-hero-skill: clamp(0.5rem, 0.46rem + 0.08vw, 0.625rem);
    --nav-h: clamp(3.25rem, 8vh, 4.5rem);
  }

  .hero__ghost {
    display: none;
  }

  .hero__line--indent {
    margin-left: clamp(0.65rem, 2vw, 1.5rem);
  }
}

/* ---- Tablet (768px–1023px): compact side-by-side ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --fs-hero-name: clamp(1.55rem, 0.5rem + 3.2vw, 2.65rem);
    --fs-hero-eyebrow: clamp(0.8125rem, 0.72rem + 0.35vw, 1rem);
    --fs-hero-role: clamp(0.8125rem, 0.74rem + 0.28vw, 0.975rem);
    --fs-hero-win: clamp(0.6875rem, 0.64rem + 0.15vw, 0.8125rem);
    --content-max: 100%;
    --portrait-max: min(42vw, 380px);
  }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 44vw);
    align-items: stretch;
    column-gap: clamp(0.5rem, 1.5vw, 1rem);
    min-height: var(--hero-block-h);
    max-height: var(--hero-block-h);
    height: var(--hero-block-h);
    padding-top: clamp(0.35rem, 0.9vh, 0.75rem);
    padding-bottom: clamp(0.35rem, 0.9vh, 0.75rem);
    padding-left: max(calc(var(--gutter) + clamp(0.85rem, 2vw, 1.85rem)), env(safe-area-inset-left, 0px));
    padding-right: 0;
    overflow: clip;
  }

  .hero__layout {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    justify-self: start;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0;
    padding-bottom: 0;
  }

  .hero__text {
    flex: 0 0 auto;
    min-height: 0;
  }

  .hero__eyebrow,
  .hero__title,
  .hero__lines,
  .hero__wins,
  .hero__actions {
    margin-left: clamp(0.5rem, 1.15vw, 1.05rem);
  }

  .hero__line--indent {
    margin-left: clamp(0.85rem, 3vw, 1.85rem);
  }

  .hero__actions {
    flex: 0 0 auto;
    margin-top: 0;
    margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
  }

  .hero__title {
    padding-bottom: clamp(0.85rem, 2vw, 1.35rem);
  }

  .hero__wins {
    flex: 0 0 auto;
    align-self: flex-start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.4rem, 1vh, 0.7rem) clamp(0.45rem, 0.9vw, 0.7rem);
    margin-top: auto;
    margin-bottom: auto;
    width: auto;
    max-width: 100%;
  }

  .hero__portrait {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: contain;
    object-position: right bottom;
  }

  .exp-scrap {
    width: min(920px, 92%);
  }

  .exp-scrap--left,
  .exp-scrap--right {
    margin-left: clamp(0rem, 2vw, 1.5rem);
    margin-right: clamp(0rem, 2vw, 1.5rem);
  }

  .proj-board {
    gap: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
  }

  .proj-pin--tall,
  .proj-pin--short {
    padding: 0 0.35rem;
  }

  .archive {
    min-height: clamp(480px, 65vw, 720px);
  }
}

/* ---- Mobile nav & single-column projects (≤1023px) ---- */
@media (max-width: 1023px) {
  .site-nav {
    flex-wrap: nowrap;
  }

  .site-nav__toggle {
    display: flex;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    align-items: center;
    justify-content: center;
  }

  .site-nav__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: max(var(--gutter), env(safe-area-inset-right, 0px));
    left: max(var(--gutter), env(safe-area-inset-left, 0px));
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    max-width: none;
    gap: 0;
    padding: 0.85rem 0;
    background: rgba(242, 234, 218, 0.98);
    border: 1px solid rgba(40, 32, 20, 0.12);
    border-radius: 2px;
    box-shadow: 0 10px 28px rgba(26, 20, 12, 0.1);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
    z-index: 101;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-nav__menu a {
    min-height: var(--touch-min);
    padding: 0.85rem 1.25rem;
    white-space: normal;
    display: flex;
    align-items: center;
  }

  .site-nav__menu a::after {
    display: none;
  }

  .site-nav__menu.is-open {
    transform: scaleY(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .proj-pin--tall,
  .proj-pin--short {
    padding: 0;
  }

  .proj-pin__overlay {
    transform: translateY(0);
    background: linear-gradient(
      to top,
      rgba(20, 16, 10, 0.96) 0%,
      rgba(20, 16, 10, 0.92) 80%,
      rgba(20, 16, 10, 0) 100%
    );
  }

  .proj-pin__foot {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }

  .proj-pin__sub,
  .proj-pin__note {
    white-space: normal;
  }

  .gallery__sub,
  .contact__sub {
    margin-top: 0;
    line-height: 1.25;
    max-width: 100%;
  }

  .section__title {
    transform: rotate(-0.5deg);
  }
}

@media (max-width: 767px) {
  .contact-scrap {
    width: 100%;
  }
}

/* ---- Tablet portrait & mobile (≤767px): vertical hero ---- */
@media (max-width: 767px) {
  .hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    max-height: none;
    height: auto;
    overflow: visible;
    padding-top: clamp(2.75rem, 8vh, 3.75rem);
    padding-bottom: clamp(2.5rem, 7vw, 3.5rem);
    gap: clamp(1rem, 3vw, 1.75rem);
  }

  .hero__layout {
    order: 1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-bottom: clamp(0.75rem, 2vw, 1.25rem);
    display: flex;
    flex-direction: column;
  }

  .hero__eyebrow,
  .hero__title,
  .hero__lines,
  .hero__wins,
  .hero__actions {
    margin-left: clamp(0.5rem, 1.15vw, 1.05rem);
  }

  .hero__wins {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    justify-content: flex-start;
    margin-top: clamp(1.25rem, 3vw, 1.75rem);
    padding-bottom: 0;
  }

  /* single column on phones — no zigzag offset */
  .hero__win:nth-child(even) {
    transform: none;
  }

  .hero__portrait {
    order: 2;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
    max-width: min(78vw, 340px);
    max-height: min(46vh, 420px);
  }

  .section {
    padding-top: clamp(2.75rem, 7vw, 4rem);
    padding-bottom: clamp(2.75rem, 7vw, 4rem);
    scroll-margin-top: calc(5.5rem + env(safe-area-inset-top, 0px));
  }

  .section__title {
    transform: rotate(-0.5deg);
    overflow-wrap: break-word;
  }

  .exp-scrap {
    width: 100%;
    align-self: stretch;
    margin-left: 0;
    margin-right: 0;
  }

  .exp-scrap__note {
    font-size: clamp(1.1rem, 4vw, 1.35rem);
  }

  .exp-scrap__org {
    font-size: clamp(1rem, 3.5vw, 1.125rem);
  }

  .gallery__sub,
  .contact__sub {
    margin-top: 0;
    line-height: 1.25;
    max-width: 100%;
  }

  .contact-scrap {
    width: 100%;
  }

  .archive {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 6vw, 3.25rem);
    padding-top: 1.5rem;
  }

  .archive__arrow,
  .archive__hint {
    display: none;
  }

  .artifact {
    position: relative;
    left: auto;
    top: auto;
    width: min(300px, 92%);
    margin: 0 auto;
    transform: rotate(var(--rot, 0deg));
  }

  .artifact__link {
    display: none;
  }

  .artifact__note,
  .artifact--note-left .artifact__note {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-top: 0.6rem;
    text-align: center;
    opacity: 1;
    transform: none;
  }

  /* Reduce scroll jank on mobile */
  .exp-scrap,
  .proj-pin {
    will-change: auto;
  }
}

/* ---- Large desktop (1440px+) ---- */
@media (min-width: 1440px) {
  :root {
    --gutter: clamp(1rem, 4vw, 4rem);
  }
}

@media (min-width: 1440px) and (min-height: 900px) {
  :root {
    --fs-hero-name: clamp(2.75rem, 1.2rem + 3.2vw + 0.5vh, 4.75rem);
    --portrait-max: clamp(280px, 26vw, 640px);
  }
}

/* ---- Small phones (≤480px, iPhone SE class) ---- */
@media (max-width: 480px) {
  :root {
    --gutter: clamp(0.875rem, 4vw, 1.25rem);
  }

  .hero {
    padding-top: clamp(2.75rem, 8vh, 3.5rem);
    padding-bottom: clamp(3rem, 9vw, 4.5rem);
  }

  .hero__layout {
    padding-bottom: clamp(1.75rem, 5vw, 2.5rem);
  }

  .hero__actions {
    margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
  }

  .hero__portrait {
    max-width: min(82vw, 320px);
    max-height: min(48vh, 400px);
  }

  .hero__btn {
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 0.5rem 0.9rem;
  }

  .hero__win-meta,
  .hero__win-place {
    font-size: var(--fs-hero-win);
  }

  .proj-pin__media img,
  .proj-pin__media {
    max-width: 100%;
  }

  .skills-list {
    gap: 0.5rem 0.65rem;
  }

  .skills-list li {
    font-size: clamp(0.75rem, 3vw, 0.875rem);
    padding: 0.5rem 0.85rem;
  }
}

/* ---- iPhone SE width (≤375px) ---- */
@media (max-width: 375px) {
  .site-nav__logo {
    font-size: var(--fs-nav-logo);
  }

  .hero__line--indent {
    margin-left: clamp(0.45rem, 3vw, 0.75rem);
  }

  .exp-scrap {
    padding: clamp(1.2rem, 4vw, 1.5rem) clamp(1rem, 3.5vw, 1.35rem);
  }

  .artifact {
    width: min(280px, 94%);
  }
}

/* ---- Touch devices: 44px minimum targets ---- */
@media (hover: none) and (pointer: coarse) {
  .hero__btn,
  .contact-action,
  .site-nav__menu a,
  .site-nav__toggle,
  .site-nav__logo {
    min-height: var(--touch-min);
  }

  .contact-action {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
  }

  .contact-action__cta {
    min-height: var(--touch-min);
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  /* Hover overlays always visible on touch */
  .proj-pin__card:hover {
    transform: none;
  }
}

/* ---- Prevent horizontal overflow from filters / wide children ---- */
.site-nav::before {
  max-width: 100vw;
}

.exp-scrap,
.contact-scrap,
.proj-pin,
.artifact,
.hero__text,
.hero__layout {
  max-width: 100%;
}

.proj-pin__media,
.artifact__frame {
  overflow: hidden;
  max-width: 100%;
}

/* ---- Respect reduced motion (layout only) ---- */
@media (prefers-reduced-motion: reduce) {
  .exp-scrap,
  .proj-pin {
    will-change: auto;
  }
}
