/* ==========================================================
   FORMA Studio — style.css
   1. Tokens  2. Base  3. Utilities  4. Header  5. Hero & marquee
   6. Sections  7. Work grid  8. Services  9. Process
   10. Studio  11. Contact form  12. Footer  13. Lightbox
   14. Motion & fallback  15. Responsive
   ========================================================== */

/* 1. Tokens ----------------------------------------------- */
:root {
  --c-bg: #f3f0ea;
  --c-alt: #e9e4da;
  --c-ink: #111111;
  --c-muted: #5c5a55;
  --c-line: #cfc8bb;
  --c-accent: #c8553d;
  --c-dark: #151514;

  --f-display: "Syne", "Arial Black", sans-serif;
  --f-body: "DM Sans", system-ui, sans-serif;

  --container: 1280px;
  --header-h: 76px;
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 2. Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body { margin: 0; font-family: var(--f-body); font-size: 17px; line-height: 1.6; color: var(--c-ink); background: var(--c-bg); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
p { margin: 0 0 1rem; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
::selection { background: var(--c-accent); color: #fff; }

/* 3. Utilities -------------------------------------------- */
.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 200; padding: 10px 16px; background: var(--c-ink); color: var(--c-bg); text-decoration: none; transition: top 0.2s; }
.skip-link:focus { top: 12px; }
.num { display: inline-block; margin-right: 0.4em; font-family: var(--f-body); font-size: 0.35em; font-weight: 500; letter-spacing: 0; vertical-align: super; color: var(--c-accent); }

.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 16px 30px; border: 0; border-radius: 999px;
  background: var(--c-ink); color: var(--c-bg); font: 700 0.95rem var(--f-body); text-decoration: none; cursor: pointer;
  transition: background 0.3s, transform 0.3s var(--ease-out);
}
.btn:hover { background: var(--c-accent); transform: translateY(-2px); }
.btn-sm { padding: 12px 22px; font-size: 0.88rem; }

/* 4. Header ----------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(243, 240, 234, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color 0.3s; }
.site-header.is-scrolled { border-bottom-color: var(--c-line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { font: 800 1.6rem var(--f-display); letter-spacing: -0.04em; text-decoration: none; }
.logo span { font-size: 0.5em; vertical-align: super; color: var(--c-accent); }
.nav-list { display: flex; align-items: center; gap: 34px; }
.nav-list a { font-weight: 500; text-decoration: none; transition: color 0.2s; }
.nav-list a:hover, .nav-list a.is-active { color: var(--c-accent); }
.nav-contact { padding: 10px 20px; border: 1.5px solid var(--c-ink); border-radius: 999px; }
.nav-list .nav-contact:hover { background: var(--c-ink); color: var(--c-bg); }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 8px; width: 44px; height: 44px; padding: 10px; border: 0; background: none; cursor: pointer; }
.nav-toggle span { height: 2px; background: var(--c-ink); transition: transform 0.3s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-5px) rotate(-45deg); }

/* 5. Hero & marquee --------------------------------------- */
.hero { padding: 72px 0 0; }
.hero-tag { font-weight: 500; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.8rem; }
.hero-title { margin: 1.5rem 0 3rem; font-size: clamp(3rem, 9vw, 8.2rem); font-weight: 800; line-height: 0.95; }
.outline { color: transparent; -webkit-text-stroke: 2px var(--c-ink); }
.circle-word { display: inline-grid; place-items: center; width: 1em; height: 1em; border-radius: 50%; background: var(--c-accent); color: var(--c-bg); font-size: 0.8em; vertical-align: 0.06em; }
.hero-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 64px; }
.hero-bottom p { max-width: 520px; margin: 0; font-size: 1.15rem; color: var(--c-muted); }
.round-link { flex: 0 0 auto; display: grid; place-items: center; width: 96px; height: 96px; border: 1.5px solid var(--c-ink); border-radius: 50%; transition: background 0.3s, color 0.3s, transform 0.3s var(--ease-out); }
.round-link:hover { background: var(--c-ink); color: var(--c-bg); transform: rotate(-45deg); }

.marquee { overflow: hidden; padding: 22px 0; background: var(--c-ink); color: var(--c-bg); }
.marquee-track { display: flex; gap: 40px; width: max-content; animation: marquee 28s linear infinite; font: 700 clamp(1.4rem, 3vw, 2.2rem) var(--f-display); white-space: nowrap; }
.marquee-track span:nth-child(even) { color: var(--c-accent); }

/* 6. Sections --------------------------------------------- */
.section { padding: 120px 0; }
.section-alt { background: var(--c-alt); }
.section-dark { background: var(--c-dark); color: var(--c-bg); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 56px; }
.section-head h2, .studio-copy h2 { font-size: clamp(2.6rem, 6vw, 5rem); }
.section-note { max-width: 380px; margin: 0; color: rgba(243, 240, 234, 0.65); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn { padding: 9px 18px; border: 1.5px solid var(--c-ink); border-radius: 999px; background: transparent; font: 500 0.9rem var(--f-body); cursor: pointer; transition: background 0.2s, color 0.2s; }
.filter-btn:hover, .filter-btn.is-active { background: var(--c-ink); color: var(--c-bg); }

/* 7. Work grid -------------------------------------------- */
.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 24px; }
.work-lg { grid-column: span 2; }
.work-grid.is-filtered { grid-template-columns: repeat(2, 1fr); }
.work-grid.is-filtered .work-lg { grid-column: auto; }
.work-item.is-hidden { display: none; }

.work-card { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: zoom-in; font: inherit; }
/* Fixed height keeps large and small tiles aligned in every row */
.work-media { display: block; height: clamp(260px, 30vw, 420px); overflow: hidden; background: var(--c-alt); }
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.work-card:hover .work-media img { transform: scale(1.04); }
.work-info { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 14px; }
.work-title { font: 700 1.3rem var(--f-display); letter-spacing: -0.02em; }
.work-type { font-size: 0.88rem; color: var(--c-muted); }
.work-card:hover .work-title { color: var(--c-accent); }

/* 8. Services --------------------------------------------- */
.service-list { border-top: 1px solid rgba(243, 240, 234, 0.2); }
.service { border-bottom: 1px solid rgba(243, 240, 234, 0.2); }
.service summary { display: grid; grid-template-columns: 80px 1fr 48px; align-items: center; padding: 32px 0; cursor: pointer; list-style: none; }
.service summary::-webkit-details-marker { display: none; }
.service-index { color: var(--c-accent); font-weight: 500; }
.service-name { font: 700 clamp(1.8rem, 4.5vw, 3.6rem) var(--f-display); letter-spacing: -0.03em; transition: color 0.3s, transform 0.4s var(--ease-out); }
.service summary:hover .service-name { color: var(--c-accent); transform: translateX(10px); }
.service-plus { position: relative; width: 40px; height: 40px; border: 1.5px solid currentColor; border-radius: 50%; justify-self: end; }
.service-plus::before, .service-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); transition: transform 0.3s; }
.service-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.service[open] .service-plus::after { transform: translate(-50%, -50%) rotate(0deg); }
.service-body { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 0 0 36px 80px; }
.service-body p { margin: 0; font-size: 1.1rem; color: rgba(243, 240, 234, 0.75); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: start; }
.chips li { padding: 7px 14px; border: 1px solid rgba(243, 240, 234, 0.3); border-radius: 999px; font-size: 0.88rem; }

/* 9. Process ---------------------------------------------- */
.process { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1.5px solid var(--c-ink); }
.process li { padding: 28px 28px 0 0; border-right: 1px solid var(--c-line); }
.process li + li { padding-left: 28px; }
.process li:last-child { border-right: 0; }
.step { display: block; margin-bottom: 40px; font-size: 0.85rem; font-weight: 500; color: var(--c-accent); }
.process h3 { font-size: 2rem; margin-bottom: 14px; }
.process p { color: var(--c-muted); }

/* 10. Studio ---------------------------------------------- */
.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; }
.studio-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--c-line); }
.studio-media img { width: 100%; height: 100%; object-fit: cover; }
.studio-copy h2 { margin-bottom: 2rem; }
.big { font-size: 1.35rem; line-height: 1.45; }
.studio-copy p:not(.big) { color: var(--c-muted); }
.facts { display: grid; gap: 0; margin: 2rem 0 0; border-top: 1px solid var(--c-line); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.facts dt { color: var(--c-muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }

/* 11. Contact form ---------------------------------------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 80px; }
.contact-intro h2 { font-size: clamp(2.6rem, 6vw, 5rem); margin-bottom: 1.5rem; }
.contact-intro p { color: var(--c-muted); font-size: 1.1rem; }
.mail-link { display: inline-block; margin: 1rem 0 2rem; font: 700 clamp(1.2rem, 2.4vw, 1.7rem) var(--f-display); text-decoration-color: var(--c-accent); text-underline-offset: 6px; }
.mail-link:hover { color: var(--c-accent); }
address { font-style: normal; color: var(--c-muted); }

.contact-form { display: grid; gap: 22px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.chip-group legend { margin-bottom: 12px; font-weight: 700; }
.chip-group label { cursor: pointer; }
.chip-group input { position: absolute; opacity: 0; pointer-events: none; }
.chip-group span { display: inline-block; padding: 10px 18px; border: 1.5px solid var(--c-line); border-radius: 999px; transition: all 0.2s; }
.chip-group label:hover span { border-color: var(--c-ink); }
.chip-group input:checked + span { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
.chip-group input:focus-visible + span { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.chip-group .error { flex-basis: 100%; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.contact-form label:not(.chip-group label) { display: block; margin-bottom: 4px; font-size: 0.9rem; font-weight: 500; color: var(--c-muted); }
.contact-form input[type="text"], .contact-form input[type="email"], .contact-form select, .contact-form textarea {
  width: 100%; padding: 12px 0; border: 0; border-bottom: 1.5px solid var(--c-line); border-radius: 0;
  background: transparent; color: var(--c-ink); font: 500 1.05rem var(--f-body); transition: border-color 0.2s;
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-bottom-color: var(--c-ink); }
.contact-form .is-invalid { border-bottom-color: #c0392b !important; }
.error { display: block; min-height: 1.1em; margin-top: 4px; font-size: 0.82rem; color: #c0392b; }
.contact-form .btn { justify-self: start; }
.form-success { margin: 0; font-weight: 500; color: #2e7d4f; }
.form-success:empty { display: none; }

/* 12. Footer ---------------------------------------------- */
.site-footer { padding: 40px 0 32px; background: var(--c-ink); color: var(--c-bg); overflow: hidden; }
.footer-big { margin: 0 0 24px; font: 800 clamp(5rem, 22vw, 20rem) / 0.8 var(--f-display); letter-spacing: -0.06em; color: var(--c-bg); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding-top: 24px; border-top: 1px solid rgba(243, 240, 234, 0.2); font-size: 0.9rem; }
.footer-row p { margin: 0; opacity: 0.7; }
.footer-links { display: flex; flex-wrap: wrap; gap: 24px; }
.footer-links a { text-decoration: none; opacity: 0.8; }
.footer-links a:hover { opacity: 1; color: var(--c-accent); }

/* 13. Lightbox -------------------------------------------- */
.lightbox { width: min(100% - 32px, 1000px); max-height: calc(100vh - 48px); padding: 0; border: 0; background: var(--c-bg); color: var(--c-ink); overflow: auto; }
.lightbox::backdrop { background: rgba(17, 17, 17, 0.8); backdrop-filter: blur(4px); }
.lightbox[open] { display: grid; grid-template-columns: 1.4fr 1fr; animation: pop 0.35s var(--ease-out); }
.lb-figure { margin: 0; min-height: 320px; background: var(--c-alt); }
.lb-figure img { width: 100%; height: 100%; object-fit: cover; }
.lb-body { align-self: center; padding: 40px; }
.lb-type { color: var(--c-accent); font-weight: 500; }
.lb-body h3 { font-size: 2.4rem; margin-bottom: 1rem; }
.lb-body p:not(.lb-type) { color: var(--c-muted); margin-bottom: 1.75rem; }
.lb-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--c-ink); color: var(--c-bg); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lb-close:hover { background: var(--c-accent); }

/* 14. Motion & fallback ----------------------------------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.img-fallback { background: linear-gradient(135deg, var(--c-alt) 0%, #d9cfbf 55%, #e3a593 100%); }
.img-fallback > img { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* 15. Responsive ------------------------------------------ */
@media (max-width: 1024px) {
  .process { grid-template-columns: 1fr 1fr; }
  .process li:nth-child(2) { border-right: 0; }
  .process li:nth-child(3) { padding-left: 0; }
  .process li:nth-child(n+3) { border-top: 1px solid var(--c-line); margin-top: 28px; }
  .studio-grid, .contact-grid { gap: 48px; }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  /* Clip-path reveal (a translated off-screen menu would widen the page) */
  /* Header uses backdrop-filter, so it is the containing block: size the menu explicitly */
  .nav { position: fixed; inset: var(--header-h) 0 auto 0; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); overflow-y: auto; background: var(--c-bg); clip-path: inset(0 0 100% 0); visibility: hidden; transition: clip-path 0.5s var(--ease), visibility 0s 0.5s; }
  .nav.is-open { clip-path: inset(0); visibility: visible; transition: clip-path 0.5s var(--ease); }
  .nav-list { flex-direction: column; align-items: flex-start; gap: 4px; padding: 32px 16px; }
  .nav-list a { font: 700 2.4rem var(--f-display); letter-spacing: -0.03em; }
  .nav-list li:last-child { margin-top: 28px; }
  .nav-contact { padding: 12px 24px; font-size: 1.1rem !important; font-family: var(--f-body) !important; }

  .work-grid, .work-grid.is-filtered { grid-template-columns: 1fr 1fr; }
  .work-lg,
  .work-grid:not(.is-filtered) .work-item:last-child { grid-column: span 2; }
  .service summary { grid-template-columns: 48px 1fr 44px; }
  .service-body { grid-template-columns: 1fr; padding-left: 48px; gap: 20px; }
  .studio-grid, .contact-grid { grid-template-columns: 1fr; }
  .lightbox[open] { grid-template-columns: 1fr; }
  .lb-figure { aspect-ratio: 3 / 2; min-height: 0; }
  .lb-body { padding: 28px; }
  .section { padding: 88px 0; }
}

@media (max-width: 560px) {
  .hero { padding-top: 40px; }
  .hero-bottom { flex-direction: column; align-items: flex-start; }
  .round-link { width: 72px; height: 72px; }
  .outline { -webkit-text-stroke-width: 1.5px; }
  .work-grid, .work-grid.is-filtered { grid-template-columns: 1fr; }
  .work-lg, .work-grid.is-filtered .work-lg,
  .work-grid:not(.is-filtered) .work-item:last-child { grid-column: auto; }
  .work-media { height: 300px; }
  .work-info { flex-direction: column; gap: 2px; }
  .service-body { padding-left: 0; }
  .process { grid-template-columns: 1fr; }
  .process li, .process li + li { padding: 24px 0 0; border-right: 0; }
  .process li + li { border-top: 1px solid var(--c-line); margin-top: 24px; }
  .step { margin-bottom: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .footer-row { flex-direction: column; }
}
