/* ============================================================
   v3 styles - warm paper "letter / workshop" design.
   Same markup & class names as v2; look and feel only.
   Palette: cream paper, ink text, rust accent. Serif voice.
   ============================================================ */

:root {
  --bg: #faf6ee;          /* paper */
  --bg-alt: #f3ecdf;      /* darker paper band */
  --panel: #fffdf7;       /* card paper */
  --panel-hover: #f7f1e4;
  --border: #ddd2bd;      /* hairline */
  --border-strong: #2b261d;
  --text: #2b261d;        /* ink */
  --muted: #6f6552;
  --accent: #a64a29;      /* dried-ink rust */
  --accent-dim: rgba(166, 74, 41, 0.12);
  --radius: 3px;          /* letterpress, not SaaS-corner */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Book Antiqua", "Times New Roman", serif;
  --mono: "Nimbus Mono PS", "Courier New", ui-monospace, monospace;
  --ink-btn: #2b261d;
  --ink-btn-text: #faf6ee;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* faint paper grain - inline SVG, no external request */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.38 0 0 0 0 0.30 0 0 0 0.028 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 28px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.accent { color: var(--accent); }
strong { color: inherit; }

/* ---------- Buttons: ink ❤ letterpress ---------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  background: transparent;
}
.btn:hover { background: rgba(43, 38, 29, 0.05); box-shadow: 2px 2px 0 var(--border-strong); }
.btn--primary {
  background: var(--ink-btn);
  border-color: var(--ink-btn);
  color: var(--ink-btn-text);
  box-shadow: 3px 3px 0 var(--accent);
}
.btn--primary:hover { background: #3d3729; box-shadow: 4px 4px 0 var(--accent); }
.btn--ghost { border-color: var(--border); }
.btn--ghost:hover { border-color: var(--border-strong); }
.btn--small { padding: 0.45rem 1.05rem; font-size: 0.85rem; box-shadow: none; }

/* ---------- Nav: a letterhead, not an app bar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 246, 238, 0.94);
  border-bottom: 1px solid var(--border-strong);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 64px;
}
.nav__brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.nav__brand .accent { color: var(--accent); }
.nav__links { display: flex; gap: 26px; }
.nav__links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--mono);
}
.nav__links a:hover { color: var(--accent); }
.nav__right { display: flex; align-items: center; gap: 16px; }
.lang-switch {
  font-family: var(--mono);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 11px;
  letter-spacing: 0.1em;
}
.lang-switch:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Hero: letter opening, photo as a print ---------- */
.hero { padding: 88px 0 56px; }
.hero__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 60px;
  align-items: center;
}
.hero__headline {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 14px 0 22px;
}
.hero__sub { font-size: 1.08rem; color: var(--muted); max-width: 560px; }
.hero__cta { display: flex; gap: 16px; margin-top: 36px; flex-wrap: wrap; }
.hero__note { margin-top: 14px; font-size: 0.9rem; font-style: italic; }

/* photo as a taped print */
.hero__photo {
  margin: 0;
  justify-self: center;
  width: 100%;
  max-width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 4px 5px 0 rgba(43, 38, 29, 0.14);
  padding: 12px 12px 14px;
  transform: rotate(1.4deg);
}
.hero__photo img {
  width: 100%;
  aspect-ratio: 0.94;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  display: block;
  background: var(--bg-alt);
  filter: saturate(0.92);
}
.hero__photo figcaption {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}
.hero__photo-caption {
  font-weight: 700;
  font-size: 1rem;
  font-style: italic;
}
.hero__photo-note { font-size: 0.8rem; font-family: var(--mono); color: var(--muted); }

/* ---------- Proof band: a ledger line, not a dashboard ---------- */
.proof { background: var(--bg-alt); border-block: 1px solid var(--border-strong); padding: 36px 0; }
.proof__grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 20px 28px;
}
.proof__grid li { text-align: left; border-left: 1.5px solid var(--accent); padding-left: 14px; }
.proof__value {
  display: block;
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.proof__label { font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* ---------- Sections: running heads in small caps ---------- */
.section { padding: 92px 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section__title {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.section__title::after { content: ""; display: block; width: 56px; height: 2px; background: var(--border-strong); margin-top: 12px; }
.section__sub { margin: 18px 0 44px; max-width: 620px; color: var(--muted); font-size: 1.02rem; }

/* ---------- About: like a friendly folio ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 44px;
  margin-top: 30px;
  align-items: start;
}
.about__text p + p { margin-top: 16px; }
.about__text { font-size: 1.0rem; color: var(--text); }
.about__quote {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 22px 26px;
  transform: rotate(-0.5deg);
}
.about__quote p { font-style: italic; font-size: 0.98rem; color: var(--text); }
.about__quote cite {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Services: ruled like a form ---------- */
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.pillar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  transition: box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pillar:hover { box-shadow: 4px 4px 0 rgba(43, 38, 29, 0.16); }
.pillar__icon { display: none; }
.pillar__title { font-size: 1.1rem; font-weight: 700; }
.pillar__desc { color: var(--muted); font-size: 0.93rem; flex: 1; }

/* ---------- Process: prominent step numbers calling out the progression ---------- */
.how-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  counter-reset: how;
}
.how-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent);
  padding: 18px 20px 16px;
  counter-increment: how;
  position: relative;
}
.how-card::before {
  content: "0" counter(how);
  display: block;
  margin: -6px 0 10px -4px;
  font-family: var(--mono);
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}
@media (min-width: 641px) {
  .how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how-card::before { font-size: 2.8rem; margin: -10px 0 12px -4px; }
}
@media (min-width: 861px) {
  .how-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.how-card__title { font-weight: 700; margin-bottom: 6px; font-size: 1.02rem; }
.how-card__desc { color: var(--muted); font-size: 0.93rem; }

/* ---------- Projects: prints pinned on the wall ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.12s ease, transform 0.12s ease, opacity 0.2s ease;
  text-align: left;
  padding: 10px 10px 14px;
  font: inherit;
  color: inherit;
  display: block;
  width: 100%;
  box-shadow: 3px 4px 0 rgba(43, 38, 29, 0.12);
}
.project-card:nth-child(2n) { transform: rotate(0.5deg); }
.project-card:nth-child(2n+1) { transform: rotate(-0.4deg); }
.project-card:hover, .project-card:focus-visible {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 5px 6px 0 rgba(43, 38, 29, 0.2);
}
.project-card--hidden { display: none; }
.projects.expanding .project-card--hidden { display: block; }
.project-card__media {
  aspect-ratio: 16/10;
  display: block;
  width: 100%;
  object-fit: cover;
  object-position: top center;
  filter: saturate(0.9) contrast(0.98);
  border: 1px solid var(--border);
}
.project-media-wrap { position: relative; display: block; }
.project-card__video-flag {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-btn-text);
  background: var(--ink-btn);
  padding: 3px 9px;
  border-radius: 2px;
}
.project-card__body { padding: 14px 6px 0; }
.project-card__title { font-weight: 700; font-size: 1.02rem; margin-bottom: 5px; }
.project-card__impact { color: var(--muted); font-size: 0.88rem; font-style: italic; }
.case-studies-toggle { margin-top: 30px; }

/* ---------- FAQ: dialogued, like letters ---------- */
.faq { max-width: 760px; }
.faq__item { border-bottom: 1px solid var(--border); }
.faq__q {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 18px 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq__q::after { content: "+"; color: var(--accent); font-weight: 700; flex-shrink: 0; font-family: var(--mono); }
.faq__q[aria-expanded="true"]::after { content: "–"; }
.faq__a { color: var(--muted); font-size: 0.95rem; padding-bottom: 20px; padding-left: 18px; border-left: 2px solid var(--border); margin-left: 8px; }
.faq__a[hidden] { display: none; }

/* ---------- Contact: postscript ---------- */
.contact { background: var(--bg-alt); border-top: 1px solid var(--border); }
.contact__inner { text-align: center; max-width: 660px; }
.contact__title { text-align: left; }
.contact__inner .section__title::after { margin-left: auto; margin-right: auto; }
.contact__buttons { display: flex; gap: 16px; justify-content: center; margin: 32px 0 18px; flex-wrap: wrap; }
.contact .small { margin-top: 24px; font-style: italic; }

/* ---------- Footer: colophon ---------- */
.footer { border-top: 1px solid var(--border-strong); padding: 30px 0 36px; font-size: 0.85rem; }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: baseline; }
.footer__inner > span:first-child { font-style: italic; }
.footer__legal { display: flex; gap: 18px; width: 100%; }
.footer__legal a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.footer__legal a:hover { color: var(--accent); }

/* ---------- Modal: a response letter ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(43, 38, 29, 0.55); }
.modal__panel {
  position: relative;
  max-width: 720px;
  margin: 5vh auto;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  box-shadow: 8px 10px 0 rgba(43, 38, 29, 0.28);
  border-radius: var(--radius);
}
.modal__content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px 38px;
  /* keep the scrollbar permanently visible (ink on paper) */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg-alt);
}
.modal__content::-webkit-scrollbar { width: 10px; }
.modal__content::-webkit-scrollbar-track { background: var(--bg-alt); }
.modal__content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 0; }

/* close button pinned to the panel corner; the popup content scrolls under it */
.modal__close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 3;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 9px;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  font-family: var(--mono);
}
.modal__close:hover { color: var(--accent); }

/* scroll cue: paper fade + mono hint at the popup's visible bottom edge.
   Shown via .modal.has-more (JS), fades out once the visitor scrolls. */
.modal__scroll-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 46px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 34%, rgba(250, 246, 238, 0));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.modal.has-more .modal__scroll-cue { opacity: 1; }
.modal__scroll-cue-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.modal__scroll-cue-arrow { color: var(--accent); font-family: var(--mono); line-height: 1; }
.modal__content h3 { font-size: 1.4rem; margin-bottom: 6px; padding-right: 32px; letter-spacing: -0.01em; }

/* case-study opener: result statement + tile as hero print */
.modal__lede { font-size: 1.06rem; color: var(--text); max-width: 58ch; margin-bottom: 16px; }
.modal__media {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--bg-alt);
  margin-bottom: 16px;
}

/* tags row under the image */
.modal__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.modal__tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 10px;
}
.modal__context { color: var(--muted); font-size: 0.9rem; font-style: italic; margin-bottom: 4px; }

.modal__label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 20px 0 4px;
}
.modal__para { color: var(--text); font-size: 0.97rem; }
.modal__list { margin: 6px 0 0 20px; color: var(--text); font-size: 0.97rem; }
.modal__list li { margin-bottom: 7px; }
.modal__list li::marker { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .project-card, .hero__photo, .about__quote { transform: none; }
  .modal__scroll-cue { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__photo { order: -1; max-width: 240px; }
  .about__grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav__links { display: none; }
  .hero { padding: 56px 0 44px; }
  .section { padding: 64px 0; }
  .contact__buttons { flex-direction: column; align-items: stretch; }
  .modal__panel { margin: 0; max-height: 100vh; box-shadow: none; }
  .modal__content { padding: 24px 24px 32px; }
}
