/* ==========================================================================
   Landing page — portrait, hero, menus, footer
   ========================================================================== */

.landing {
  overflow-x: hidden;
}
/* The first screen: hero on top, the bar with the switch at the bottom */
.landing__screen {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: calc(100dvh - var(--header-h, 4.6rem));
}

/* Blueprint grid (code mode) and film grain (photo mode) */
.landing::before,
.landing::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.8s var(--ease);
}
.landing::before {
  z-index: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0;
}
.landing::after {
  z-index: 3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.09;
  mix-blend-mode: overlay;
}
html[data-mode="code"] .landing::before {
  opacity: 1;
}
html[data-mode="code"] .landing::after {
  opacity: 0;
}

/* ---------- Portrait ---------- */
.portrait {
  position: fixed;
  z-index: 1;
  top: -12dvh;
  left: 50%;
  height: 128dvh;
  aspect-ratio: 597 / 916;
  translate: -50% 0;
  -webkit-mask-image: radial-gradient(ellipse 62% 60% at 50% 46%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 60% at 50% 46%, #000 62%, transparent 100%);
}
.portrait__img,
.portrait__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.portrait__img {
  object-fit: cover;
  object-position: 50% 40%; /* keep in sync with FOCAL in portrait.js */
}
.portrait__canvas {
  opacity: 0;
}
.portrait.is-live .portrait__canvas {
  opacity: 1;
}
.portrait.is-live .portrait__img {
  opacity: 0;
}

/* ---------- Header / footer sit above the portrait ---------- */
.site-header,
.hero,
.site-footer {
  position: relative;
  z-index: 2;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  padding: 2rem var(--pad);
}

.eyebrow {
  margin-bottom: 1.1rem;
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  margin-right: 0.9rem;
  background: var(--muted);
  vertical-align: middle;
}

.hero__name {
  font-family: var(--font-display);
  font-size: var(--fs-5xl);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero__name em {
  font-style: italic;
  color: var(--accent);
}

.hero__tag {
  max-width: 28ch;
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.25;
  color: var(--ink);
}

/* Code mode voice */
html[data-mode="code"] .eyebrow {
  text-transform: lowercase;
  letter-spacing: 0;
}
html[data-mode="code"] .eyebrow::before {
  display: none;
}
html[data-mode="code"] .hero__name {
  font-size: var(--fs-4xl);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.06em;
  text-transform: lowercase;
}
html[data-mode="code"] .hero__name em {
  font-style: normal;
}
html[data-mode="code"] .hero__name::after {
  content: "_";
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
html[data-mode="code"] .hero__tag {
  max-width: 34ch;
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- Menus ---------- */
.menu ul {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  text-align: right;
}
.menu a,
.menu .is-soon {
  display: inline-block;
  padding: 0.15rem 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.2;
}
.menu a {
  position: relative;
  transition: color var(--t-fast);
}
.menu a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  scale: 0 1;
  transform-origin: right;
  transition: scale var(--t) var(--ease);
}
.menu a:hover,
.menu a:focus-visible {
  color: var(--accent);
}
.menu a:hover::after,
.menu a:focus-visible::after {
  scale: 1 1;
}
.menu .is-soon {
  color: var(--muted);
}

html[data-mode="code"] .menu a,
html[data-mode="code"] .menu .is-soon {
  font-size: var(--fs-base);
  text-transform: lowercase;
}
html[data-mode="code"] .menu a::before {
  content: "> ";
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--t-fast);
}
html[data-mode="code"] .menu a:hover::before,
html[data-mode="code"] .menu a:focus-visible::before {
  opacity: 1;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--pad) var(--pad);
}
.cta {
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
a.cta {
  padding: 0.5rem 0;
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--accent);
  transition: color var(--t-fast);
}
a.cta:hover {
  color: var(--accent);
}
html[data-mode="code"] .cta {
  text-transform: lowercase;
  letter-spacing: 0;
}

/* ---------- Mode-change entrance ---------- */
[data-m] {
  animation: rise 0.7s var(--ease) both;
}
.menu[data-m] {
  animation-delay: 0.08s;
}
@keyframes rise {
  from {
    opacity: 0;
    translate: 0 0.6rem;
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .portrait {
    top: 0;
    left: -9%;
    width: 118%;
    height: 64dvh;
    aspect-ratio: auto;
    translate: none;
    -webkit-mask-image: linear-gradient(#000 42%, transparent 94%);
    mask-image: linear-gradient(#000 42%, transparent 94%);
  }
  .hero {
    grid-template-columns: 1fr;
    align-content: end;
    gap: 1.5rem;
  }
  .menu ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    justify-items: start;
    text-align: left;
  }
  .menu a,
  .site-footer {
    flex-wrap: wrap;
  }
}

@media (max-height: 560px) and (min-width: 721px) {
  .hero__name {
    font-size: clamp(3rem, 18vh, 7rem);
  }
}

/* ==========================================================================
   Guided steps, intro loader and entrance
   ========================================================================== */

/* ---------- Primary next steps ---------- */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
  margin-top: 2rem;
}
.hero__more {
  padding: 0.5rem 0;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  box-shadow: inset 0 -1px 0 var(--muted);
  transition: color var(--t-fast), box-shadow var(--t-fast);
}
.hero__more:hover {
  color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
}
html[data-mode="code"] .hero__more {
  letter-spacing: 0;
  text-transform: lowercase;
}

/* ---------- First-visit hint on the switch ---------- */
.hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.hint::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}
.site-footer {
  gap: 1rem 1.25rem;
}

/* ---------- Intro loader (first visit of a session, landing page only) ---------- */
.loader {
  display: none;
}
html.first-visit .loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  background: var(--bg);
  clip-path: inset(0);
  transition: clip-path 0.9s cubic-bezier(0.76, 0, 0.24, 1), visibility 0s 0.9s;
}
html.first-visit .loader.is-done {
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
}
.loader__name {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  white-space: pre;
}
.loader__sub {
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.loader__bar {
  width: min(14rem, 50vw);
  height: 1px;
  margin-top: 0.75rem;
  background: var(--line);
  overflow: hidden;
}
.loader__bar::after {
  content: "";
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: loader-bar 1.2s cubic-bezier(0.65, 0, 0.35, 1) both;
}
@keyframes loader-bar {
  from {
    scale: 0 1;
  }
}

/* ---------- Entrance: the page assembles once the portrait is ready ---------- */
html[data-intro].js.motion .landing .portrait,
html[data-intro].js.motion .landing .site-header,
html[data-intro].js.motion .landing .eyebrow,
html[data-intro].js.motion .landing .hero__name,
html[data-intro].js.motion .landing .hero__tag,
html[data-intro].js.motion .landing .hero__actions,
html[data-intro].js.motion .landing .menu,
html[data-intro].js.motion .landing .site-footer {
  transition: opacity 0.9s var(--ease), translate 0.9s var(--ease), scale 1.6s var(--ease), clip-path 1s var(--ease);
}
html[data-intro].js.motion:not(.is-entered) .landing .portrait {
  opacity: 0;
  scale: 1.06;
}
html[data-intro].js.motion:not(.is-entered) .landing .site-header,
html[data-intro].js.motion:not(.is-entered) .landing .eyebrow,
html[data-intro].js.motion:not(.is-entered) .landing .hero__tag,
html[data-intro].js.motion:not(.is-entered) .landing .hero__actions,
html[data-intro].js.motion:not(.is-entered) .landing .menu,
html[data-intro].js.motion:not(.is-entered) .landing .site-footer {
  opacity: 0;
  translate: 0 1rem;
}
html[data-intro].js.motion:not(.is-entered) .landing .hero__name {
  clip-path: inset(0 0 100% 0);
  translate: 0 2rem;
}
html[data-intro].js.motion .landing .hero__name {
  clip-path: inset(-10% -5% -15% -5%);
}
html[data-intro].js.motion .landing .eyebrow { transition-delay: 0.15s; }
html[data-intro].js.motion .landing .hero__name { transition-delay: 0.25s; }
html[data-intro].js.motion .landing .hero__tag { transition-delay: 0.45s; }
html[data-intro].js.motion .landing .hero__actions { transition-delay: 0.55s; }
html[data-intro].js.motion .landing .menu { transition-delay: 0.65s; }
html[data-intro].js.motion .landing .site-footer { transition-delay: 0.75s; }
html[data-intro].js.motion .landing .site-header { transition-delay: 0.75s; }

/* Keep the menu readable where it sits on top of the portrait */
.landing .site-nav a {
  color: var(--ink);
}
@media (max-width: 720px) {
  .landing .site-header {
    padding-bottom: 2rem;
    background: linear-gradient(rgb(8 8 8 / 0.97) 62%, transparent);
  }
}

/* ==========================================================================
   Below the first screen: selected photographs, selected software, the story,
   and a way to get in touch. These slide up over the fixed portrait.
   ========================================================================== */
.home {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
/* Each side leads with its own work */
html[data-mode="code"] .home-block--code {
  order: -1;
}
.home-block,
.home-story,
.home-cta {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding: var(--space-section) var(--pad) 0;
}
.home-block__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.75rem 2rem;
  margin-bottom: 2rem;
}
.home-block__title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.home-block__title em {
  color: var(--muted);
}
.home-block__text {
  grid-column: 1;
  max-width: 44ch;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.3;
  color: color-mix(in srgb, var(--ink) 80%, var(--bg));
}
.home-block__head .button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
}
@media (max-width: 720px) {
  .home-block__head {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-block__head .button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 0.5rem;
  }
}
html[data-mode="code"] .home-block__title,
html[data-mode="code"] .home-cta__title {
  font-weight: 700;
  letter-spacing: -0.05em;
  text-transform: lowercase;
}
html[data-mode="code"] .home-block__title em,
html[data-mode="code"] .home-cta__title em {
  font-style: normal;
}

.home-photos {
  columns: 3;
  column-gap: 0.75rem;
}
@media (max-width: 720px) {
  .home-photos {
    columns: 2;
    column-gap: 0.5rem;
  }
}
.home-photo {
  display: block;
  margin-bottom: 0.75rem;
  overflow: hidden;
  break-inside: avoid;
  background: #111;
}
.home-photo img {
  width: 100%;
  height: auto;
  transition: scale var(--t-slow) var(--ease);
}
.home-photo:hover img,
.home-photo:focus-visible img {
  scale: 1.03;
}

.home-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}
.home-case {
  display: grid;
  gap: 0.4rem;
  padding-bottom: 1.25rem;
  border: 1px solid var(--line);
  transition: border-color var(--t);
}
.home-case:hover,
.home-case:focus-visible {
  border-color: var(--ink);
}
.home-case img {
  width: 100%;
  height: auto;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.home-case__name,
.home-case__text {
  padding-inline: 1.25rem;
}
.home-case__name {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.1;
}
.home-case__text {
  max-width: 44ch;
  color: var(--muted);
}

.home-story__kicker {
  margin-bottom: 1.25rem;
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-story__quote {
  max-width: 22ch;
  margin-bottom: 2rem;
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
html[data-mode="code"] .home-story__quote {
  max-width: 30ch;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.05em;
  text-transform: lowercase;
}
html[data-mode="code"] .home-story__kicker {
  text-transform: lowercase;
  letter-spacing: 0;
}

.home-cta {
  padding-bottom: var(--space-section);
}
.home-cta__title {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.home-cta__title em {
  color: var(--muted);
}
.home-cta__text {
  max-width: 40ch;
  margin: 1.25rem 0 2rem;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.3;
}
.page-footer--home {
  position: relative;
  z-index: 2;
  margin-top: 0;
  background: var(--bg);
}

/* Phones: the first screen keeps to the name, the pitch and one action.
   Outside links live in the footer and the menu. */
@media (max-width: 720px) {
  .hero .menu {
    display: none;
  }
}

/* Doorway to the other side, after the contact prompt */
.home-door {
  margin-top: var(--space-section);
  padding-top: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
}
.home-door .home-story__kicker {
  margin-bottom: 1rem;
}

/* Wide screens have the side switch in the header, so the one under the hero is dropped */
@media (min-width: 1001px) {
  .site-footer .mode-switch {
    display: none;
  }
}

/* ---------- Photographer side: the name is signed, not typeset ----------
   Whole name in italic, tilted like handwriting, with a pen stroke under it
   that draws itself when the page enters. */
.hero__sign {
  display: none;
}
html[data-mode="photo"] .hero__name {
  position: relative;
  width: fit-content;
  padding-bottom: 0.2em;
  font-style: italic;
  letter-spacing: -0.035em;
  rotate: -4deg;
  transform-origin: 0 100%;
}
html[data-mode="photo"] .hero__sign {
  display: block;
  position: absolute;
  left: -1%;
  bottom: -0.02em;
  width: 102%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  animation: none;
}
.hero__sign path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.3s var(--ease) 0.6s;
}
html[data-intro].js.motion:not(.is-entered) .hero__sign path {
  stroke-dashoffset: 1;
}

/* ---------- Hero dock: outside links as icons, named by tooltip ---------- */
.dock ul {
  display: grid;
  justify-items: end;
  gap: 0.6rem;
}
.dock a,
html[data-mode="code"] .dock a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgb(8 8 8 / 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast), translate var(--t) var(--ease);
}
.dock a::after {
  content: none;
}
.dock a:hover,
.dock a:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  translate: -4px 0;
}
.dock svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dock svg .is-solid,
.dock svg.is-filled {
  fill: currentColor;
  stroke: none;
}
.dock svg text {
  fill: currentColor;
  stroke: none;
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Coder side: invitation to the free website check */
.home-audit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  font-size: var(--fs-md);
}
