@font-face {
  font-family: "Optician Sans";
  src: url("assets/fonts/Optician-Sans.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Hauora";
  src: url("assets/fonts/Hauora-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Erbaum";
  src: url("assets/fonts/Erbaum-Book.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/gamekit/inter-body.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

html, body {
  margin: 0;
  background: #dddddd;
  font-family: "Optician Sans", sans-serif;
  color: #111111;
}

/* Proportional scaling: the desktop layout is authored at a FIXED width so the
   composition never reflows; app.js only ever transforms (translate + scale) it
   to fit the viewport (32px gutters below 1440, centered at/above it) and sets
   .scale-viewport's height to the scaled height (a transformed element keeps its
   unscaled layout box, so the wrapper compensates and overflow is clipped). */
.scale-viewport {
  width: 100%;
  overflow: hidden;
}

.page {
  width: 1280px; /* 1200 content + 2x40 padding — the authored layout size */
  box-sizing: border-box;
  margin: 0;
  /* Bottom padding (not a child margin, which would collapse out of the scaled,
     overflow-clipped page and get lost) gives space below the last content. */
  padding: 0 40px 100px;
  transform-origin: top left;
}

/* nav */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0;
  position: relative;
}

.nav-link {
  font-size: 16px;
  letter-spacing: 0.1em;
  color: #111111;
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

.nav-logo {
  height: 60px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Case-study page headers (back link + logo + dots) collapse the dots on
   mobile and lay out left/right instead of the homepage's pure centering,
   so the back link and logo don't fight for the same centered spot. */
@media (max-width: 700px) {
  .nav:has(.nav-link) {
    justify-content: space-between;
  }

  .nav:has(.nav-link) .nav-dots {
    display: none;
  }

  .nav:has(.nav-link) .nav-logo {
    position: static;
    transform: none;
    height: 36px;
  }
}

.nav-dots {
  width: 180px;
  height: 4px;
  background-image: radial-gradient(circle, #111111 1.5px, transparent 1.6px);
  background-size: 14px 4px;
  background-repeat: repeat-x;
}

/* hero */

.hero {
  position: relative;
  margin-top: 150px;
  transition: margin-top 0.4s ease;
}

body.about-open .hero {
  margin-top: 60px;
  min-height: 1020px;
}

.hero-eyebrow {
  font-size: 30px;
  letter-spacing: 0em;
  margin: 0 0 4px;
  color: transparent;
  -webkit-text-stroke: 1.4px #111111;
}

.hero-title-wrap {
  position: relative;
  width: 100%;
}

.hero-title-bg-clip {
  width: 100%;
}

.hero-title-bg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-title-bg-mobile {
  display: none;
}

.hero-face-wrap {
  position: absolute;
  top: -90px;
  right: 220px;
  left: auto;
  width: 720px;
  height: 720px;
  transform: scale(0.72);
  transform-origin: top right;
  transition: top 0.4s ease, right 0.4s ease, left 0.4s ease, transform 0.4s ease;
}

body.about-open .hero-face-wrap {
  top: 160px;
  right: auto;
  left: 0;
  transform: scale(0.7);
  transform-origin: top left;
}

.hero-face-wrap .stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-cta-buttons {
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 2;
}

.hero-cta-buttons[hidden] {
  display: none;
}

.cta-btn {
  background: #111111;
  color: #ff3d32;
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  text-decoration: none;
  width: max-content;
  border: none;
  cursor: pointer;
}

.cta-btn:hover {
  opacity: 0.85;
}

/* Mobile-only controls are laid out in the mobile media query; hidden here. */
.expanded-controls-m,
.mobile-cta {
  display: none;
}

.about-close-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 2;
}

.about-close-btn[hidden] {
  display: none;
}

.about-content {
  position: absolute;
  top: 264px;
  left: 542px;
  width: 480px;
}

.about-content p {
  margin: 0 0 16px;
  font-family: "Inter", sans-serif;
  font-weight: normal;
  font-size: 16px;
  line-height: 24px;
  color: #111111;
}

.about-content p:last-child {
  margin-bottom: 0;
}

.about-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.about-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1.5px solid #111111;
  border-radius: 0;
  padding: 10px 18px;
  font-family: "Optician Sans", sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: #111111;
  text-decoration: none;
  cursor: pointer;
}

.about-action-btn:hover {
  background: #111111;
  color: #ffffff;
}

.about-action-btn:hover .about-action-icon {
  filter: invert(1);
}

.about-action-icon {
  width: 16px;
  height: 14px;
}

.about-stats {
  position: absolute;
  top: 30px;
  left: 542px;
  width: 480px;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  row-gap: 24px;
  column-gap: 32px;
  z-index: 2;
}

.about-stats[hidden] {
  display: none;
}

.about-stat {
  text-align: center;
  color: #111111;
}

.about-stat strong {
  display: block;
  font-family: "Optician Sans", sans-serif;
  font-weight: normal;
  font-size: 35px;
  line-height: 1;
}

.about-stat-infinity {
  transform: scale(1.5);
  transform-origin: center;
}

.about-stat span {
  display: block;
  margin-top: 0;
  font-family: "Optician Sans", sans-serif;
  font-size: 21px;
  line-height: 1;
}

.reach-content {
  position: absolute;
  top: 264px;
  left: 542px;
  width: 550px;
}

.reach-content form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reach-content label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: "Erbaum", sans-serif;
  font-size: 16px;
  color: #111111;
}

.reach-content input,
.reach-content textarea {
  background: #e0e0e0;
  border: 1px solid #111111;
  border-radius: 0;
  padding: 10px 12px;
  font-family: "Hauora", sans-serif;
  font-size: 14px;
  color: #111111;
}

.reach-content textarea {
  resize: vertical;
}

/* Keep browser autofill consistent with the portfolio palette. */
.reach-content input:-webkit-autofill,
.reach-content input:-webkit-autofill:hover,
.reach-content input:-webkit-autofill:focus,
.reach-content textarea:-webkit-autofill,
.reach-content textarea:-webkit-autofill:hover,
.reach-content textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: #111111;
  -webkit-box-shadow: 0 0 0 1000px #e0e0e0 inset;
  box-shadow: 0 0 0 1000px #e0e0e0 inset;
  caret-color: #111111;
  transition: background-color 9999s ease-out 0s;
}

.reach-content input:focus,
.reach-content textarea:focus {
  outline: 2px solid #111111;
  outline-offset: -1px;
}

.reach-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.send-btn {
  background: #111111;
  color: #ffffff;
  border: none;
  padding: 10px 26px;
  font-family: "Optician Sans", sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.send-btn:disabled {
  background: #b0b0b0;
  cursor: not-allowed;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid #111111;
  padding: 10px 20px;
  font-family: "Optician Sans", sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #111111;
  cursor: pointer;
}

.back-btn:hover {
  background: #111111;
  color: #ffffff;
}

.back-btn:hover .back-icon {
  filter: invert(1);
}

.back-icon {
  width: 12px;
  height: 12px;
}

.back-icon-arrow {
  width: 16px;
  height: 16px;
  transform: scaleX(-1);
}

.send-btn:hover {
  opacity: 0.85;
}

.cta-arrow {
  width: 22px;
  height: 22px;
}

.hero-tags {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: -126px;
}

.hero-tags[hidden] {
  display: none;
}

.tag-row {
  display: flex;
  gap: 12px;
}

.tag {
  background: #d0d0d0;
  color: #111111;
  font-size: 16px;
  letter-spacing: 0.06em;
  border: 1.5px solid #111111;
  border-radius: 999px;
  padding: 8px 14px;
  text-align: center;
  opacity: 0.8;
}

/* cards */

.cards-viewport {
  overflow: hidden;
  /* Leave room for hover growth without moving the cards or controls. */
  padding-block: 8px;
  margin-top: 152px;
  margin-bottom: 72px;
}

.cards-track {
  display: flex;
  width: max-content;
  gap: 24px;
}

.project-card {
  position: relative;
  flex: 0 0 calc((1120px - 36px) / 2.5);
  aspect-ratio: 3 / 1.6;
  background: #111111;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.project-card-link {
  text-decoration: none;
  transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .project-card-link:hover {
    transform: scale(1.03);
    z-index: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card-link {
    transition: none;
  }
}

.project-tags {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 4px;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  background: #ff3d32;
  color: #111111;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  box-sizing: border-box;
}

.project-tag-outline {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  box-sizing: border-box;
  background: transparent;
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
}

.project-logo {
  max-width: 220px;
  max-height: 60px;
}

.carousel-controls {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  margin-top: -56px;
  margin-bottom: 0;
}

.carousel-controls[hidden] {
  display: none;
}

.carousel-arrows {
  display: flex;
}

.see-all-btn {
  background: transparent;
  border: 1.5px solid #111111;
  color: #111111;
  font-family: "Optician Sans", sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  padding: 14px 22px;
  cursor: pointer;
}

.see-all-btn:hover {
  background: #111111;
  color: #ffffff;
}

/* Grid view: all projects in 3 columns, replacing the carousel. */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 160px;
  margin-bottom: 24px;
}

.projects-grid[hidden] {
  display: none;
}

/* When the grid is open, hide the carousel and its arrows. */
body.grid-open .cards-viewport,
body.grid-open .carousel-arrows {
  display: none;
}

body.grid-open .carousel-controls {
  margin-top: 0;
  justify-content: flex-end;
}

.carousel-btn {
  width: 48px;
  height: 48px;
  border: 1.5px solid #111111;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.carousel-btn:last-child {
  border-left: none;
}

.carousel-btn:hover {
  background: #111111;
}

.carousel-btn:hover .carousel-arrow-icon {
  filter: invert(1);
}

.carousel-arrow-icon {
  width: 20px;
  height: 20px;
}

.carousel-arrow-left {
  transform: scaleX(-1);
}

/* face animation internals — do not change class names, app.js targets these */

.face-container {
  position: relative;
  width: 720px;
  aspect-ratio: 1 / 1;
}

.layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.layer-inner {
  display: block;
  width: 100%;
  height: 100%;
}

.expr-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* mobile */

@media (max-width: 600px) {
  .page {
    width: auto;
    padding: 0 16px;
  }

  .nav {
    justify-content: center;
  }

  .nav-link,
  .nav-dots {
    display: none;
  }

  .hero {
    margin-top: 48px;
  }

  .hero-eyebrow {
    font-size: 18px;
    -webkit-text-stroke-width: 0.8px;
  }

  .hero-title-bg-desktop {
    display: none;
  }

  .hero-title-bg-mobile {
    display: block;
  }

  .hero-face-wrap {
    top: 64px;
    right: auto;
    left: 50%;
    margin-left: -360px;
    transform: scale(0.42);
    transform-origin: top center;
  }

  .hero-cta-buttons {
    display: none;
  }

  .hero-tags {
    margin-top: 180px;
  }

  /* Tags grow to span the full width, two per row. flex-basis auto keeps each
     pill proportional to its label (wider words stay wider). */
  .tag {
    flex: 1 1 auto;
    font-size: 18px;
    padding: 12px 16px;
  }

  /* Projects stack vertically instead of the carousel. */
  .cards-viewport {
    overflow: visible;
    padding-block: 0;
    margin-top: 48px;
    margin-bottom: 48px;
  }

  .cards-track {
    flex-direction: column;
    width: auto;
    gap: 24px;
  }

  .project-card {
    flex: none;
    width: 100%;
  }

  /* Hide the carousel loop clones and the arrow controls on mobile. */
  .project-card[aria-hidden="true"] {
    display: none;
  }

  .carousel-controls {
    display: none;
  }

  /* Full-width ABOUT trigger in the default view (below the tags). */
  .mobile-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin-top: 24px;
    background: #111111;
    color: #ffffff;
    border: none;
    padding: 14px 16px;
    font-family: "Optician Sans", sans-serif;
    font-size: 18px;
    letter-spacing: 0.04em;
    cursor: pointer;
  }

  .mobile-cta .cta-arrow {
    filter: brightness(0) invert(1); /* red arrow -> white */
  }

  .mobile-cta[hidden] {
    display: none;
  }

  /* --- Expanded (About / Reach) views on mobile ------------------------- */

  /* Keep the mobile hero metrics when expanded (override the desktop rules). */
  body.about-open .hero {
    margin-top: 48px;
    min-height: 0;
  }

  body.about-open .hero-face-wrap {
    top: 64px;
    right: auto;
    left: 50%;
    margin-left: -360px;
    transform: scale(0.42);
    transform-origin: top center;
  }

  /* Stack the hero panels vertically, ordered below the wordmark/face. */
  .hero-title-wrap {
    display: flex;
    flex-direction: column;
  }

  .hero-title-bg-clip { order: 1; }
  .expanded-controls-m { order: 2; } /* CLOSE / BACK above everything */
  .about-stats { order: 3; }
  .about-content { order: 4; }
  .reach-content { order: 5; }

  .about-stats {
    position: static;
    top: auto;
    left: auto;
    width: auto;
    min-width: 0;
    margin: 0 0 24px;
    grid-template-columns: 1fr 1fr; /* equal, shrinkable — no overflow */
    column-gap: 16px;
  }

  .about-stat strong {
    font-size: 28px;
  }

  .about-stat span {
    font-size: 15px;
  }

  .about-content,
  .reach-content {
    position: static;
    top: auto;
    left: auto;
    width: auto;
    min-width: 0;
  }

  /* The desktop close (in the flag) is replaced by the mobile control row. */
  .about-close-btn {
    display: none;
  }

  /* Reserve fixed space for the fixed-size head overlay so the controls sit a
     consistent 24px below it at any width under 600px (the head doesn't scale,
     so one reserved height works everywhere; the wordmark image is shorter). */
  body.about-open .hero-title-bg-clip {
    min-height: 338px;
  }

  .expanded-controls-m {
    display: flex;
    gap: 12px;
    margin: 24px 0; /* 24px below the reserved head space */
  }

  .expanded-controls-m[hidden] {
    display: none;
  }

  .expanded-controls-m .back-btn[hidden] {
    display: none;
  }

  .expanded-controls-m .back-btn,
  .expanded-controls-m .cta-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* CLOSE is a secondary (outlined) button on mobile. */
  .mc-close-btn {
    background: transparent;
    color: #111111;
    border: 1.5px solid #111111;
  }

  .mc-close-btn .cta-arrow {
    filter: brightness(0); /* red X -> black */
  }

  /* About actions: full-width stacked, REACH OUT (primary) above RESUME. */
  .about-actions {
    flex-direction: column-reverse;
  }

  .about-action-btn {
    width: 100%;
    justify-content: center;
  }

  /* REACH OUT is the primary (filled) button. */
  #reach-toggle {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
  }

  /* Reach form: the in-form back is replaced by the control row; SEND fills. */
  #reach-back {
    display: none;
  }

  .send-btn {
    width: 100%;
  }

  /* Consistent button height (matching CLOSE), font, and icon size across all
     mobile buttons. */
  .expanded-controls-m .cta-btn,
  .expanded-controls-m .back-btn,
  .about-action-btn,
  .send-btn,
  .mobile-cta {
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
  }

  .mobile-cta {
    height: 52px;
  }

  .mc-close-btn .cta-arrow,
  .expanded-controls-m .back-icon,
  .about-action-icon,
  .mobile-cta .cta-arrow {
    width: auto;
    height: 18px;
  }
}

/* Opt-in, on-device face tracking is offered only in the mobile layout. */
.face-tracking-panel {
  display: none;
}

@media (max-width: 600px) {
  .face-tracking-panel {
    display: block;
    margin-top: 132px;
    text-align: right;
  }

  /* The tracking control now occupies the head's reserved space. */
  .face-tracking-panel + .hero-tags {
    margin-top: 20px;
  }

  body.about-open .face-tracking-panel {
    display: none;
  }

  .face-tracking-toggle {
    width: auto;
    min-height: 32px;
    box-sizing: border-box;
    padding: 6px 0 4px;
    border: 0;
    border-bottom: 1px solid #111111;
    background: transparent;
    color: #111111;
    font-family: "Optician Sans", sans-serif;
    font-size: 13px;
    letter-spacing: 0.05em;
    cursor: pointer;
  }

  .face-tracking-toggle[aria-pressed="true"] {
    color: #ff3d32;
    border-bottom-color: #ff3d32;
  }

  .face-tracking-toggle:disabled {
    cursor: wait;
    opacity: 0.6;
  }

  .face-tracking-note {
    width: min(230px, 75%);
    min-height: 16px;
    margin: 6px 0 0 auto;
    font-family: "Inter", sans-serif;
    font-size: 10px;
    line-height: 1.4;
    color: #555555;
  }

  .face-tracking-note.is-error {
    color: #b5231b;
  }

  .face-tracking-video {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
}
