/* Larin Labs — site styles */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/archivo-var.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/public-sans-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  --navy: #1B2E4B;
  --navy-hover: #3A5788;
  --navy-btn-hover: #2A4269;
  --muted: #4A5A73;
  --stone: #9A958A;
  --cream: #EDEAE2;
  --cream-light: #F7F4EC;
  --cream-card: #F2EFE7;
  --cream-btn-hover: #E2DED3;
  --border: #D6D1C4;
  --border-2: #C4BFB2;
  --border-3: #E2DED3;
  --sans: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --disp: "Archivo", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --work-frame-ratio: 21/10;
  --work-img-ratio: 21/9;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; background: var(--cream-light); }
body {
  margin: 0;
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  font-family: var(--sans);
  color: var(--navy);
  font-size: 16px;
  line-height: 1.65;
}
body.page-case { background: var(--cream-light); }
a { color: var(--navy); }
a:hover { color: var(--navy-hover); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--navy-hover); outline-offset: 2px; }

.container {
  margin: 0 auto;
  max-width: 1200px;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: content-box;
}

.section-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -.02em;
  margin: 0 0 24px;
}

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 7px 14px;
}

.mono-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0 0 10px;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 244, 236, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand span {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -.02em;
  color: var(--navy);
  transition: color .2s ease;
}
.brand:hover span { color: var(--navy-hover); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-link {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
  padding-top: 5px;
  padding-bottom: 5px;
  background-image: linear-gradient(var(--navy), var(--navy));
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size .28s ease;
}
.nav-link:hover { background-size: 100% 1.5px; color: var(--navy); }
.nav-cta {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--navy);
  color: var(--cream-light);
  padding: 10px 20px;
  border-radius: 3px;
}
.nav-cta:hover { background: var(--navy-btn-hover); color: var(--cream-light); }
.nav-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  flex-direction: column;
  gap: 5px;
}
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--navy); }
.nav-back {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
}
.nav-back:hover { color: var(--navy-hover); }

/* ---------- Hero ---------- */
.hero {
  scroll-margin-top: 72px;
  position: relative;
  overflow: hidden;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 72px);
  min-height: calc(100svh - 72px);
  padding: 48px 0;
  box-sizing: border-box;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-inner {
  position: relative;
  margin-top: -72px;
  padding-top: 48px;
  padding-bottom: 48px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.hero-kicker {
  font-family: var(--disp);
  font-weight: 600;
  font-size: clamp(28px, 2.4vw, 34px);
  letter-spacing: -.015em;
  margin: 0 0 12px;
  color: var(--muted);
}
.hero-window {
  font-size: clamp(56px, 5.4vw, 72px);
  height: 1.15em;
  overflow: hidden;
  transition: height .65s cubic-bezier(.65, 0, .35, 1);
}
.hero-track {
  transform: translateY(0);
  transition: transform .65s cubic-bezier(.65, 0, .35, 1);
}
.hero-track.no-anim, .hero-window.no-anim { transition: none; }
.hero-word {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
  height: 1.15em;
  white-space: nowrap;
  color: var(--navy);
}

/* ---------- Work / case study cards ---------- */
.work { background: var(--cream-light); border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.work .container, .services .container, .about .container { padding-top: 56px; padding-bottom: 64px; }
.work-card {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 56px;
  align-items: start;
  padding: 28px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
  margin-bottom: 24px;
}
.work-card:last-child { margin-bottom: 0; }
.work-copy { min-width: 0; }
.work-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(24px, 2vw, 30px);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 20px 0 16px;
}
.work-title a { color: var(--navy); text-decoration: none; }
.work-title a:hover { color: var(--navy-hover); }
.work-desc { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin: 0; text-wrap: pretty; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--navy);
  color: var(--cream-light);
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 3px;
  padding: 12px 22px;
  transition: background .25s ease;
}
.btn:hover { background: var(--navy-hover); color: var(--cream-light); }
.work-cta { margin-top: 34px; }
.work-frame {
  aspect-ratio: var(--work-frame-ratio);
  min-width: 0;
  position: relative;
  background: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
/* letterbox fill: the same image, enlarged and blurred, behind the crisp copy;
   partly transparent so the white frame lightens it toward white */
.work-frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.2);
  filter: blur(24px);
  opacity: .32;
}
.work-frame-inner { width: 100%; aspect-ratio: var(--work-img-ratio); position: relative; }
.work-frame img, .gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.work-frame img { border-radius: 8px; }

/* ---------- Services ---------- */
.services { background: var(--cream); border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.svc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  align-items: stretch;
}
.svc-card {
  min-width: 0;
  background: var(--cream-card);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 28px 28px 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.svc-num { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--stone); }
.svc-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(24px, 2vw, 30px);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 20px 0 16px;
  text-wrap: pretty;
}
.svc-desc { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin: 0 0 24px; text-wrap: pretty; }
.svc-divider { border-top: 1px solid var(--border); margin-top: auto; }
.svc-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0;
  padding: 16px 0 0;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  display: block;
}
.svc-head .svc-sym { display: none; }
.svc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.svc-list li { padding: 12px 0; border-bottom: 1px solid var(--border-3); }
.svc-list li:last-child { border-bottom: none; }

/* ---------- About ---------- */
.about { background: var(--cream-light); border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.about-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: center;
  padding: 28px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
}
.about-photo {
  width: 280px;
  height: 320px;
  object-fit: cover;
  object-position: top;
  border-radius: 6px;
  display: block;
}
.about-copy { min-width: 0; }
.about-lead {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(24px, 2vw, 30px);
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--navy);
  margin: 0;
  text-wrap: pretty;
}
.about-body { font-size: 15.5px; line-height: 1.7; color: var(--muted); margin: 18px 0 0; text-wrap: pretty; }
.about-links { display: flex; gap: 28px; margin-top: 28px; flex-wrap: wrap; }
.mono-link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--border-2);
}
.mono-link:hover { color: var(--navy-hover); }

/* ---------- Footer / contact ---------- */
.footer { background: var(--navy); color: var(--cream-light); scroll-margin-top: 72px; }
.footer .container { padding-top: 56px; padding-bottom: 32px; }
.footer-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(30px, 3.6vw, 46px);
  letter-spacing: -.02em;
  line-height: 1.15;
  margin: 0;
  max-width: 22ch;
  text-wrap: pretty;
}
.footer-sub { font-size: 15px; line-height: 1.65; color: rgba(247, 244, 236, .82); margin: 16px 0 0; max-width: 48ch; }
.footer-sub a { color: var(--cream-light); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(247, 244, 236, .35); }
.footer-sub a:hover { text-decoration-color: var(--cream-light); color: var(--cream-light); }
.contact-form {
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-full { grid-column: 1 / -1; }
.field label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(247, 244, 236, .6);
}
.field input, .field textarea {
  background: rgba(247, 244, 236, .06);
  border: 1px solid rgba(247, 244, 236, .28);
  border-radius: 3px;
  padding: 13px 14px;
  font-family: var(--disp);
  font-size: 15px;
  color: var(--cream-light);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.field input:focus, .field textarea:focus { border-color: var(--cream-light); }
.field.invalid input, .field.invalid textarea { border-color: #E8A9A0; }
.field-error {
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: #E8A9A0;
}
.field.invalid .field-error { display: block; }
.form-status a { color: var(--cream-light); }
.field textarea { resize: vertical; min-height: 120px; }
.hp-field { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; }
.form-submit {
  background: var(--cream-light);
  color: var(--navy);
  border: none;
  border-radius: 3px;
  padding: 14px 28px;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .25s ease;
}
.form-submit:hover { background: var(--cream-btn-hover); }
.form-submit:disabled { opacity: .6; cursor: default; }
.form-status { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: rgba(247, 244, 236, .75); }
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid rgba(247, 244, 236, .22);
  flex-wrap: wrap;
}
.footer-mark { display: flex; align-items: center; gap: 10px; }
.footer-mark svg { height: 18px; width: auto; display: block; }
.footer-mark span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: rgba(247, 244, 236, .6); }

/* ---------- Case study pages ---------- */
.case-hero .container { padding-top: 64px; padding-bottom: 40px; }
.case-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(36px, 4.6vw, 60px);
  letter-spacing: -.02em;
  line-height: 1.05;
  margin: 24px 0 18px;
}
.case-sub { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; color: var(--muted); margin: 0; text-wrap: pretty; }
.case-meta {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.case-meta .mono-label { margin-bottom: 6px; }
.case-meta p:not(.mono-label) { font-size: 14.5px; margin: 0; }
.meta-wide { max-width: 52ch; }
.meta-narrow { max-width: 40ch; }

.gallery-section .container { padding-top: 8px; padding-bottom: 24px; }
.gallery { position: relative; overflow: hidden; }
.gallery-track {
  display: flex;
  transform: translateX(0);
  transition: transform .5s cubic-bezier(.65, 0, .35, 1);
}
.gallery-slide { flex: 0 0 100%; margin-right: 2%; aspect-ratio: 21/9; min-width: 0; }
.gallery-slide img { border-radius: 6px; }
.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  background: rgba(247, 244, 236, .92);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  color: var(--navy);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}
.gallery-btn:hover { background: var(--cream-light); }
.gallery-btn[hidden] { display: none; }
.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }
.gallery-count {
  position: absolute;
  right: 16px;
  bottom: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
  background: rgba(247, 244, 236, .92);
  border-radius: 3px;
  padding: 5px 9px;
}

.case-body .container { padding-top: 32px; padding-bottom: 28px; }
.case-sections { display: flex; flex-direction: column; gap: 40px; }
.case-sections p:not(.mono-label) { font-size: 16px; line-height: 1.7; color: var(--muted); margin: 0; text-wrap: pretty; }
.case-sections p + p:not(.mono-label) { margin-top: 14px; }
.case-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.case-footer .footer-mark span { color: var(--stone); }
.next-link { font-family: var(--disp); font-weight: 600; font-size: 14px; text-decoration: none; color: var(--navy); }
.next-link:hover { color: var(--navy-hover); }

/* ---------- 404 ---------- */
.notfound {
  min-height: calc(100vh - 72px);
  min-height: calc(100svh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  box-sizing: border-box;
}

/* ---------- ≤1099px: services stack + work card ratio morph ---------- */
@media (max-width: 1099px) {
  .svc-grid { grid-template-columns: 1fr; gap: 16px; }
  .svc-head { cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; }
  .svc-head .svc-sym { display: block; font-family: var(--mono); font-size: 16px; line-height: 1; color: var(--muted); }
  .svc-acc { max-height: 0; overflow: hidden; transition: max-height .45s cubic-bezier(.65, 0, .35, 1); }
  .svc-card.open .svc-acc { max-height: 420px; }
}

/* ---------- ≤899px: work cards stack ---------- */
@media (max-width: 899px) {
  .work-card { grid-template-columns: 1fr; gap: 20px; }
  .work-frame { aspect-ratio: 21/10; }
  .work-frame-inner { aspect-ratio: 21/9; }
}

/* ---------- ≤719px: mobile nav, hero, about, form ---------- */
@media (max-width: 719px) {
  .nav-burger { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(247, 244, 236, .98);
    border-bottom: 1px solid var(--border);
    padding: 24px 24px 28px;
  }
  .nav.open .nav-links { display: flex; }
  .hero-window { font-size: clamp(38px, 11vw, 56px); }
  .hero-word { height: 2.3em; white-space: normal; text-wrap: balance; }
  .work-card { padding: 20px; margin-bottom: 16px; }
  .work-card:last-child { margin-bottom: 0; }
  .about-card { display: block; padding: 20px; }
  .about-photo { width: 132px; height: 152px; float: left; margin: 4px 18px 8px 0; }
  .contact-form { grid-template-columns: 1fr; gap: 18px; }
  .case-meta { gap: 22px; margin-top: 28px; }
  .case-footer { flex-direction: column-reverse; align-items: flex-start; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-track, .hero-window, .gallery-track, .svc-acc, .nav-link { transition: none; }
}
