/* ==========================================================================
   Code Quatre — Styles
   Depends on variables.css (loaded first).
   ========================================================================== */

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--c-bg);
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--size-base);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}
button {
  font: inherit;
}
img {
  max-width: 100%;
  display: block;
}
p {
  margin: 0;
}

::selection {
  background: var(--c-accent-soft);
  color: var(--c-text);
}
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: var(--space-4);
  left: calc(var(--rail) + var(--space-4));
  z-index: calc(var(--z-menu) + 1);
  padding: var(--space-2) var(--space-4);
  background: var(--c-text);
  color: var(--c-bg);
  border-radius: var(--radius-s);
  text-decoration: none;
  transform: translateY(calc(-100% - 3rem));
}
.skip-link:focus {
  transform: none;
}

.theme-transition,
.theme-transition * {
  transition:
    background-color 0.6s var(--ease-out),
    color 0.6s var(--ease-out),
    border-color 0.6s var(--ease-out),
    text-decoration-color 0.6s !important;
}

.js-waiting .hero-title {
  visibility: hidden;
}

/* ---------- Rail ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-nav);
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--c-bg);
  border-right: 1px solid var(--c-border);
}

.burger {
  width: 100%;
  height: var(--rail);
  flex-shrink: 0;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  cursor: pointer;
}
.burger span {
  display: block;
  width: 1.9rem;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--duration-menu) var(--ease-in-out);
}
.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8.5px) scaleX(0);
}
.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8.5px) scaleX(0);
}

.rail-counter {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--size-xs);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-soft);
}
.dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dots i {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--c-border);
  transition:
    height var(--duration-slow) var(--ease-out),
    background var(--duration-normal);
}
.dots i.active {
  height: 22px;
  background: var(--c-accent);
}

.rail-name {
  margin: auto 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: 1.2rem;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--c-text);
  cursor: pointer;
  transition: color 0.4s var(--ease-out);
}
.rail-name:hover,
.rail-name:focus-visible {
  color: var(--c-text-soft);
}

.theme {
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: var(--space-6);
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.theme svg {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-slow) var(--ease-in-out);
}
[data-theme="light"] .theme svg {
  transform: rotate(180deg);
}

.rail-year {
  margin-bottom: var(--space-6);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: var(--size-xs);
  color: var(--c-text-soft);
  white-space: nowrap;
}

/* ---------- Menu ---------- */
.menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--rail);
  z-index: var(--z-menu);
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  padding: var(--space-12) var(--page-margin);
  background: var(--c-menu);
}
.menu ol {
  grid-column: 1;
  grid-row: 1 / 4;
  align-self: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-link {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading-thin);
  font-size: var(--size-menu);
  line-height: 1;
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-text-muted);
  transition: color var(--duration-normal) var(--ease-out);
}
.menu-link:hover,
.menu-link:focus-visible,
.menu-link[aria-current] {
  color: var(--c-text);
}
.menu-number {
  display: block;
  min-width: 1.7em;
  font-size: 0.34em;
  letter-spacing: 0;
}
.menu-mask {
  display: block;
  overflow: hidden;
  padding-top: 0.14em;
}
.menu-word {
  display: block;
}

.close {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-xl);
  line-height: 1;
  text-transform: uppercase;
  color: var(--c-text);
}
.close:hover {
  color: var(--c-accent-text);
}

.menu-socials {
  grid-column: 2;
  grid-row: 3;
  align-self: end;
  display: flex;
  gap: var(--space-8);
}
.menu-socials a {
  text-decoration: none;
}
.menu-socials a:hover {
  color: var(--c-accent-text);
}

/* ---------- Horizontal track ---------- */
.track-wrap {
  margin-left: var(--rail);
  width: calc(100vw - var(--rail));
  height: 100svh;
  overflow: hidden;
}
.track {
  position: relative;
  display: flex;
  height: 100%;
  width: max-content;
  will-change: transform;
}
.panel {
  position: relative;
  flex: 0 0 auto;
  width: calc(100vw - var(--rail));
  height: 100%;
  padding: var(--space-12) var(--page-margin);
}

.section-title {
  margin: 0;
  padding-top: 0.12em;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-2xl);
  line-height: 1;
  text-transform: uppercase;
}

/* ---------- Home ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr minmax(15rem, 24rem);
  grid-template-rows: 1fr auto;
  column-gap: var(--space-12);
}
.hero-title {
  margin: 0;
  /* Centre the wordmark in the free space above the bottom row; the intro
     stays pinned to the top-right so the layout keeps its diagonal tension. */
  align-self: center;
}
.hero-title img {
  display: block;
  width: 100%;
  max-width: 44rem;
  height: auto;
}
/* One logo per theme: greige on dark, encre on light */
.hero-title .hero-logo--light,
[data-theme="light"] .hero-title .hero-logo--dark {
  display: none;
}
[data-theme="light"] .hero-title .hero-logo--light {
  display: block;
}
.hero-intro {
  font-size: var(--size-base);
  line-height: 1.35;
  max-width: 28ch;
}
.hero-bottom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: var(--space-8);
  line-height: 1.4;
  color: var(--c-text-soft);
}

/* Consistent "go to next section" cue, pinned to the same corner on every panel */
.next {
  position: absolute;
  right: var(--page-margin);
  bottom: var(--space-12);
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    border-color var(--duration-normal),
    color var(--duration-normal);
}
.next svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  transition: transform var(--duration-slow) var(--ease-out);
}
.next:hover {
  border-color: var(--c-accent);
  color: var(--c-accent-text);
}
.next:hover svg {
  transform: translateX(3px);
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  column-gap: var(--space-16);
}
.col-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
}
.col-left > p {
  max-width: 34ch;
  line-height: 1.45;
}
.col-right {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  row-gap: var(--space-12);
  min-height: 0;
}
.about-text {
  font-size: var(--size-base);
  line-height: 1.4;
  max-width: 44ch;
}
.col-right-bottom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--space-8);
  min-height: 0;
}
.col-right-bottom .left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.quote {
  font-size: var(--size-xs);
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.photo {
  /* Round avatar: sized by the height left under the text so it shrinks as
     the copy grows, capped so it stays a portrait rather than a poster. */
  height: 100%;
  max-height: 11rem;
  width: auto;
  aspect-ratio: 1;
  justify-self: start;
  align-self: end;
  margin-bottom: var(--space-8);
  margin-left: 60px;
  display: grid;
  place-items: center;
  background: var(--c-image);
  border-radius: 50%;
  border: 1px solid var(--c-border);
  color: var(--c-text-soft);
  font-size: var(--size-xs);
  overflow: hidden;
}
.photo picture,
.photo img {
  display: block;
  width: 100%;
  height: 100%;
}
.photo img {
  object-fit: cover;
  object-position: center 20%;
}

/* ---------- Projects ---------- */
.projects {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.projects-list {
  flex: 1;
  min-height: 0;
  display: flex;
  /* Sit the cards in the vertical middle of the space under the title so
     there's breathing room above the bottom edge (and the "next" button). */
  align-items: center;
  gap: var(--space-8);
  list-style: none;
  margin: 0;
  padding: 0;
}
.project {
  flex: 1 1 0;
  min-width: 0;
}
.project a {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-decoration: none;
}
.project-image {
  /* Landscape tiles sized by width (a third of the row each) rather than by
     viewport height: shorter, and they match how a site hero actually looks. */
  width: 100%;
  aspect-ratio: 4 / 3;
  align-self: flex-start;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--c-image);
  border-radius: var(--radius-xs);
  color: var(--c-text-soft);
  font-size: var(--size-xs);
}
.project-image picture,
.project-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.project-image > * {
  transition: transform 1.2s var(--ease-out);
}
.project a:hover .project-image > * {
  transform: scale(1.06);
}
.project-name {
  padding-top: 0.1em;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-l);
  line-height: 1;
  text-transform: uppercase;
}
.project a:hover .project-name {
  color: var(--c-accent-text);
}
.project-type {
  font-size: var(--size-s);
  line-height: 1.3;
  color: var(--c-text-soft);
}

/* ---------- Contact (footer) ---------- */
.contact {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--space-12);
  color: var(--c-accent-text);
}
.contact-top {
  display: grid;
  grid-template-columns: 1fr minmax(18rem, 26rem);
  align-items: center;
  column-gap: var(--space-16);
  min-height: 0;
}
.poster {
  margin: 0;
  padding-top: 0.12em;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading-thin);
  font-size: min(7.5vw, 20svh);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--c-accent);
  white-space: nowrap;
}

/* Form: no boxes, one hairline under each field that warms up on focus. */
.contact-form {
  display: grid;
  gap: var(--space-6);
  color: var(--c-text);
}
.contact-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.field {
  display: grid;
  gap: var(--space-1);
}
.field label {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-s);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-soft);
  transition: color var(--duration-normal);
}
.field label small {
  margin-left: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--size-xs);
  letter-spacing: 0;
  text-transform: none;
  color: var(--c-text-muted);
}
.field input,
.field textarea {
  width: 100%;
  padding: var(--space-2) 0 var(--space-3);
  font: inherit;
  font-size: var(--size-base);
  line-height: 1.4;
  color: var(--c-text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--c-border);
  border-radius: 0;
  outline: none;
  transition: border-color var(--duration-normal);
}
.field textarea {
  resize: none;
  min-height: 4.5rem;
}
.field:focus-within label {
  color: var(--c-accent-text);
}
.field input:focus,
.field textarea:focus,
.field.is-invalid input,
.field.is-invalid textarea {
  border-bottom-color: var(--c-accent);
}
.field.is-invalid label {
  color: var(--c-accent-text);
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-2);
}
.send {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  height: 3.5rem;
  padding: 0 var(--space-6) 0 var(--space-8);
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-base);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text);
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    border-color var(--duration-normal),
    color var(--duration-normal),
    opacity var(--duration-normal);
}
.send span {
  padding-top: 0.15em;
}
.send svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  transition: transform var(--duration-slow) var(--ease-out);
}
.send:hover,
.send:focus-visible {
  border-color: var(--c-accent);
  color: var(--c-accent-text);
  outline: none;
}
.send:hover svg {
  transform: translateX(3px);
}
.send:disabled {
  opacity: 0.5;
  cursor: wait;
}
.contact-status {
  font-size: var(--size-s);
  color: var(--c-text-soft);
}
.contact-status a {
  color: inherit;
}

.contact-thanks {
  color: var(--c-text);
  font-size: var(--size-base);
  max-width: 26rem;
}
.contact-thanks-title {
  margin-bottom: var(--space-3);
  font-family: var(--font-heading);
  font-weight: var(--weight-heading-thin);
  font-size: var(--size-2xl);
  line-height: 1;
  color: var(--c-accent);
}

.contact-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: var(--space-8);
}
.contact-label {
  font-size: var(--size-l);
  line-height: 1.2;
  margin-bottom: var(--space-3);
  padding-top: 0.1em;
}
.contact-links {
  display: flex;
  gap: var(--space-8);
  font-size: var(--size-base);
}
.contact-bottom a {
  text-decoration: none;
}
.contact-bottom a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.contact-center {
  text-align: center;
}
.contact-name {
  padding-top: 0.1em;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: var(--size-l);
  line-height: 1.1;
}
.contact-edition {
  font-size: var(--size-s);
}
.contact-privacy {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--size-xs);
  color: var(--c-text-soft);
}
.contact-right {
  text-align: right;
}

/* ---------- Desktop: hidden scrollbar ---------- */
@media (min-width: 901px) and (min-height: 561px) {
  html {
    scrollbar-width: none;
  }
  html::-webkit-scrollbar {
    display: none;
  }
}

/* ---------- Mobile and portrait tablet ---------- */
@media (max-width: 900px), (max-height: 560px) {
  .rail {
    inset: 0 0 auto 0;
    width: auto;
    height: var(--mobile-bar);
    flex-direction: row;
    gap: var(--space-4);
    padding-right: var(--space-4);
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
  }
  .burger {
    width: var(--mobile-bar);
    height: var(--mobile-bar);
    border-bottom: 0;
    border-right: 1px solid var(--c-border);
  }
  .rail-counter,
  .rail-year {
    display: none;
  }
  .rail-name {
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0 auto 0 0;
    font-size: 1.15rem;
  }
  .theme {
    margin: 0;
  }
  .skip-link {
    left: var(--space-4);
  }

  .menu {
    top: var(--mobile-bar);
    left: 0;
    padding: var(--space-8) var(--page-margin);
  }
  .menu ol {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .menu {
    overflow-y: auto;
  }
  .menu-link {
    font-size: min(11vw, 12svh);
  }
  .menu-socials {
    grid-column: 1 / -1;
  }

  .track-wrap {
    margin-left: 0;
    width: auto;
    height: auto;
    overflow: visible;
    padding-top: var(--mobile-bar);
  }
  .track {
    flex-direction: column;
    width: auto;
    height: auto;
  }
  .panel {
    width: auto;
    height: auto;
    min-height: calc(100svh - var(--mobile-bar));
    padding: var(--space-12) var(--page-margin);
  }

  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    row-gap: var(--space-8);
  }
  .hero-title img {
    max-width: 100%;
  }
  .hero-bottom {
    grid-template-columns: 1fr;
    align-self: end;
  }
  .next svg {
    transform: rotate(90deg);
  }
  .next:hover svg {
    transform: rotate(90deg) translateX(3px);
  }

  .about {
    grid-template-columns: 1fr;
    row-gap: var(--space-8);
  }
  .col-left {
    display: contents;
  }
  .col-left > p {
    order: 2;
  }
  .col-right {
    grid-template-rows: auto auto;
  }
  .col-right-bottom {
    grid-template-columns: 1fr;
    row-gap: var(--space-8);
  }
  .photo {
    height: auto;
    max-height: none;
    width: 10rem;
    justify-self: start;
    margin-bottom: 0;
  }

  .projects-list {
    flex-direction: column;
    align-items: stretch;
  }
  .project-image {
    height: auto;
    width: 100%;
  }

  .contact {
    gap: var(--space-16);
  }
  .contact-top {
    grid-template-columns: 1fr;
    align-items: start;
    row-gap: var(--space-12);
  }
  .poster {
    white-space: normal;
    font-size: 13vw;
  }
  .contact-bottom {
    grid-template-columns: 1fr;
  }
  .contact-center,
  .contact-right {
    text-align: left;
  }
}

/* ---------- Portrait tablet: two-column projects ---------- */
@media (min-width: 600px) and (max-width: 900px) {
  .projects-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
  .hero-title img {
    max-width: 100%;
  }
}
