/*
 * OUTSPACE STUDIOS — v19 polish layer
 * Loads after style.css and motion-v18.css. Fixes and refinements only;
 * the visual identity is unchanged.
 *
 *  1. Foundations & accessibility
 *  2. Header (fixed glass bar, smart hide, mobile menu fix)
 *  3. Hero & marquee
 *  4. Legibility (minimum sizes, contrast)
 *  5. Studio page overflow fix
 *  6. Testimonials layout
 *  7. Work archive (filters, empty state)
 *  8. Case-study pager
 *  9. Forms & status messages
 * 10. Footer navigation
 * 11. Prose pages (privacy, 404)
 * 12. Print
 */

:root {
  --os-focus: #8b6dff;
  --os-muted: #625e6a;
  --os-header-h: 88px;
}

/* ───────────── 1. Foundations & accessibility ───────────── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
::selection { background: #7956f4; color: #fff; }
:focus-visible { outline: 2px solid var(--os-focus); outline-offset: 3px; border-radius: 4px; }
.nav-cta:focus-visible, .contact-button:focus-visible, .circle-link:focus-visible, .filter-button:focus-visible { border-radius: 40px; }
.skip-link { border-radius: 0 0 10px 0; font-weight: 600; }
.skip-link:focus { left: 0; top: 0; }
body.menu-open, body.lightbox-open, body.project-invite-open { overflow: hidden; }

/* Content that waits for a scroll reveal must stay visible if JavaScript is unavailable. */
html:not(.js) .reveal, html:not(.js) .os-reveal { opacity: 1; transform: none; }

/* ───────────── 2. Header ───────────── */
.header, .inner-page .header {
  position: fixed;
  inset: 0 0 auto;
  transition: transform .45s var(--os-ease, cubic-bezier(.2,.75,.2,1)), background-color .35s ease, border-color .35s ease, color .25s ease;
}
.header-inner { transition: height .35s var(--os-ease, cubic-bezier(.2,.75,.2,1)); }
.header.is-scrolled .header-inner { height: 68px; }
.header.is-scrolled .brand { width: 150px; }
.brand { transition: width .35s var(--os-ease, cubic-bezier(.2,.75,.2,1)); }
.header.is-hidden { transform: translateY(-102%); }

/* Scrolled: translucent glass bar. Inner pages and dark theme use ink glass. */
.header.is-scrolled {
  background: rgba(9, 9, 13, .84);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: rgba(255, 255, 255, .1);
}
body:not(.inner-page) .header.is-scrolled { background: rgba(243, 241, 237, .88); border-bottom-color: rgba(17, 16, 22, .08); }
:root[data-theme="dark"] body:not(.inner-page) .header.is-scrolled { background: rgba(9, 9, 13, .84); border-bottom-color: rgba(255, 255, 255, .1); }

/* Current page indicator */
.nav > a[aria-current]:not(.nav-cta) { opacity: 1; position: relative; }
.nav > a[aria-current]:not(.nav-cta)::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: #8b6dff;
}

.menu-toggle { color: inherit; cursor: pointer; }
.menu-toggle span { background: currentColor; }

/* Mobile menu. v18 gave the light-theme homepage dark link text on a dark panel
   and white hamburger lines on a light bar, making the navigation unusable. */
@media (max-width: 900px) {
  .nav {
    top: 100%;
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 28px 60px rgba(0, 0, 0, .38);
  }
  .header .nav > a, .header .nav > a:not(.nav-cta), .header .nav .theme-toggle { color: #f7f6fa !important; opacity: 1 !important; }
  .header .nav .nav-cta { border-color: rgba(255, 255, 255, .45) !important; }
  .header .nav .nav-cta span { color: #b6a5ff; }
  .header .nav .theme-toggle { border-color: rgba(255, 255, 255, .38) !important; background: rgba(255, 255, 255, .07) !important; }
  .nav > a[aria-current]:not(.nav-cta)::after { left: 0; bottom: 50%; margin: 0; transform: translateY(50%); }
  .nav > a[aria-current]:not(.nav-cta) { padding-left: 16px; }
}

/* ───────────── 3. Hero & marquee ───────────── */
.hero-art-card { transition: transform .5s var(--os-ease, cubic-bezier(.2,.75,.2,1)); }
.hero-art-card figcaption { font-size: 9px; height: 30px; }
.discipline-track { gap: 0; }
.discipline-set { display: flex; align-items: center; gap: 27px; padding-right: 27px; flex: 0 0 auto; }
.discipline-marquee:hover .discipline-track { animation-play-state: paused; }
@media (max-width: 760px) {
  .discipline-set { gap: 18px; padding-right: 18px; }
  .hero-art-card figcaption { font-size: 0; height: 24px; }
  .hero-art-card figcaption b { font-size: 9px; margin-left: auto; }
}

/* ───────────── 4. Legibility ───────────── */
.eyebrow { font-size: 11px; }
.hero-index, .hero-side-label { font-size: 10px; }
.client-note { font-size: 12px; }
.footer-bottom { font-size: 12px; }
.slider-status { font-size: 11px; }
.team-card-top { font-size: 9px; }
.team-card-bottom { font-size: 8px; letter-spacing: .1em; }
.team-card-info > span { font-size: 11px; }
.editorial-home-meta > div > span, .portfolio-tile .work-meta > div > span, .work-showcase-grid .work-meta > div > span { font-size: 10px; }
.editorial-home-meta p { font-size: 12px; }
.portfolio-tile .tile-description { font-size: 12px; }
.work-number, .editorial-card-index { font-size: 10px !important; }

/* Darker secondary text on light surfaces (WCAG AA). Dark theme keeps its own palette. */
:root:not([data-theme="dark"]) .section-light .section-intro,
:root:not([data-theme="dark"]) .section-light .service-row p,
:root:not([data-theme="dark"]) .section-light .service-no,
:root:not([data-theme="dark"]) .section-light .eyebrow,
:root:not([data-theme="dark"]) .editorial-home-meta > div > span,
:root:not([data-theme="dark"]) .editorial-home-meta p,
:root:not([data-theme="dark"]) .portfolio-tile .tile-description,
:root:not([data-theme="dark"]) .portfolio-tile .work-meta > div > span,
:root:not([data-theme="dark"]) .quote-person span,
:root:not([data-theme="dark"]) .slider-status,
:root:not([data-theme="dark"]) .archive-side > p,
:root:not([data-theme="dark"]) .archive-count,
:root:not([data-theme="dark"]) .portfolio-note,
:root:not([data-theme="dark"]) .service-detail > span,
:root:not([data-theme="dark"]) .service-detail p,
:root:not([data-theme="dark"]) .studio-story p:not(.eyebrow),
:root:not([data-theme="dark"]) .contact-page-copy,
:root:not([data-theme="dark"]) .contact-methods span { color: var(--os-muted); }
:root:not([data-theme="dark"]) .client-note { color: #5f5b66; }

@media (max-width: 600px) {
  .editorial-home-meta > div > span, .portfolio-tile .work-meta > div > span, .work-showcase-grid .work-meta > div > span { font-size: 9px; letter-spacing: .06em; }
  .editorial-home-meta p, .portfolio-tile .tile-description { font-size: 11px; }
  .work-number, .editorial-card-index { font-size: 9px !important; }
  .team-card-bottom > span { display: none; }
  .team-card-bottom { justify-content: flex-end; }
  .hero-index { font-size: 9px; }
}

/* ───────────── 5. Studio page overflow fix ─────────────
   .principles:after is absolutely positioned; without a positioned parent it escaped
   the section and widened the page by 100px (studio.html). */
.principles { position: relative; overflow: hidden; }

/* ───────────── 6. Testimonials ───────────── */
@media (min-width: 861px) {
  .testimonial {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 232px;
    grid-template-rows: auto 1fr auto;
    column-gap: clamp(40px, 7vw, 100px);
    align-items: start;
  }
  .testimonial .quote-mark { grid-column: 1; grid-row: 1; }
  .testimonial blockquote { grid-column: 1; grid-row: 2; margin: 22px 0 32px; }
  .testimonial .quote-person { display: contents; }
  .testimonial .quote-person img {
    grid-column: 2; grid-row: 1 / span 3; align-self: center; justify-self: center;
    width: 190px; height: 190px; border-radius: 50%; object-fit: cover;
    box-shadow: 0 0 0 14px rgba(121, 86, 244, .07), 0 0 0 15px rgba(121, 86, 244, .28);
  }
  .testimonial .quote-person > div { grid-column: 1; grid-row: 3; }
}

/* ───────────── 7. Work archive ───────────── */
.filter-bar { top: 0; transition: top .45s var(--os-ease, cubic-bezier(.2,.75,.2,1)); }
body:not(.header-hidden) .filter-bar { top: 68px; }
.filter-bar[role="group"] { align-items: center; }
.filter-count { margin-left: 8px; font-size: 10px; opacity: .55; font-variant-numeric: tabular-nums; }
.filter-button.is-active .filter-count { opacity: .8; }
.filter-status { font-size: 12px; letter-spacing: .02em; color: var(--os-muted); margin: 0 0 26px; min-height: 1.4em; }
.filter-empty { text-align: center; padding: 70px 0 40px; color: var(--os-muted); }
.filter-empty[hidden] { display: none; }
.filter-empty b { display: block; font-size: 22px; letter-spacing: -.04em; color: inherit; margin-bottom: 6px; }
.lightbox-image { transition: opacity .25s ease; }
.lightbox-image.is-loading { opacity: .25; }
.lightbox-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) {
  body:not(.header-hidden) .filter-bar { top: auto; }
}
:root[data-theme="dark"] .filter-bar { background: rgba(23, 21, 28, .92); border-bottom-color: rgba(255, 255, 255, .08); }
:root[data-theme="dark"] .filter-button { color: #cfcad8; border-color: #3d3946; }
:root[data-theme="dark"] .filter-button:hover, :root[data-theme="dark"] .filter-button.is-active { background: #f2f0f5; color: #111015; border-color: #f2f0f5; }
:root[data-theme="dark"] .filter-status, :root[data-theme="dark"] .filter-empty { color: #aaa5b3; }

/* ───────────── 8. Case-study pager ───────────── */
.ic-crumb a { color: inherit; transition: color .2s; }
.ic-crumb a:hover { color: #c6b8ff; }
.ic-pager { background: #0c0b10; border-top: 1px solid #25222c; }
.ic-pager .ic-wrap { display: grid; grid-template-columns: 1fr 1fr; }
.ic-pager a { display: flex; align-items: center; gap: 24px; padding: 46px 0; color: #f6f4f2; transition: color .25s; }
.ic-pager a:hover { color: #c6b8ff; }
.ic-pager a:last-child { justify-content: flex-end; text-align: right; border-left: 1px solid #25222c; padding-left: 40px; }
.ic-pager a:first-child { padding-right: 40px; }
.ic-pager img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; background: #1b1921; transition: transform .5s var(--os-ease, cubic-bezier(.2,.75,.2,1)); }
.ic-pager a:hover img { transform: scale(1.06) rotate(-2deg); }
.ic-pager small { display: block; font-size: 11px; letter-spacing: .16em; color: #a99bce; margin-bottom: 8px; }
.ic-pager strong { display: block; font-size: clamp(20px, 2.4vw, 32px); line-height: 1.1; letter-spacing: -.045em; font-weight: 500; }
@media (max-width: 700px) {
  .ic-pager .ic-wrap { grid-template-columns: 1fr; }
  .ic-pager a, .ic-pager a:last-child { padding: 28px 0; border-left: 0; justify-content: flex-start; text-align: left; }
  .ic-pager a:last-child { border-top: 1px solid #25222c; flex-direction: row-reverse; justify-content: flex-end; }
  .ic-pager img { width: 68px; height: 68px; }
}

/* ───────────── 9. Forms & status messages ───────────── */
.form-status { min-height: 1.6em; font-size: 14px; line-height: 1.5; margin: 14px 0 0; }
.form-status.is-success { color: #137a4d; font-weight: 600; }
.form-status.is-error { color: #b3283a; font-weight: 600; }
.form-status:focus { outline: none; }
.project-invite-status.is-success { color: #7be0b0; }
.project-invite-status.is-error { color: #ff8e9c; }
:root[data-theme="dark"] .form-status.is-success { color: #6fdca8; }
:root[data-theme="dark"] .form-status.is-error { color: #ff8e9c; }
.project-enquiry :user-invalid, .project-invite-card :user-invalid { border-color: #d6455a; }
.form-privacy { font-size: 12px; line-height: 1.6; color: var(--os-muted); margin: 14px 0 0; }
.form-privacy a { border-bottom: 1px solid currentColor; }
:root[data-theme="dark"] .form-privacy { color: #aaa5b3; }
.contact-button:disabled { opacity: .6; cursor: progress; transform: none; }

/* ───────────── 10. Footer navigation ───────────── */
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px 30px; padding: 26px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.footer-nav a { color: #c9c5d3; transition: color .2s; }
.footer-nav a:hover, .footer-nav a[aria-current="page"] { color: #fff; }
.footer-social a, .footer-bottom a { transition: color .2s; }
.footer-top p { max-width: 24ch; }

/* ───────────── 11. Prose pages (privacy, 404) ───────────── */
.prose { max-width: 760px; }
.prose h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.1; letter-spacing: -.05em; font-weight: 500; margin: 58px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 16px; line-height: 1.75; color: var(--os-muted); }
.prose ul { padding-left: 1.2em; margin: 12px 0; }
.prose a { color: var(--violet, #7855ff); border-bottom: 1px solid currentColor; }
.prose-meta { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--os-muted); margin-bottom: 40px; }
:root[data-theme="dark"] .prose p, :root[data-theme="dark"] .prose li, :root[data-theme="dark"] .prose-meta { color: #b3aebd; }
:root[data-theme="dark"] .prose a { color: #b6a5ff; }
.notfound-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.notfound-actions .contact-button { display: inline-flex; gap: 22px; min-width: 0; }
.notfound-actions .contact-button.ghost { background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .45); }
.inner-hero .notfound-code { font-size: clamp(120px, 24vw, 280px); line-height: .8; letter-spacing: -.09em; margin: 0 0 10px; font-weight: 600; }

/* ───────────── 12. Print ───────────── */
@media print {
  .header, .whatsapp, .outspace-chat, .project-invite, .os-scroll-progress, .work-lightbox { display: none !important; }
  .reveal, .os-reveal { opacity: 1 !important; transform: none !important; }
}

/* Case-study body links */
.ic-bodycopy a { color: #c6b8ff; border-bottom: 1px solid currentColor; }
.ic-bodycopy a:hover { color: #fff; }

/* ───────────── 13. Artwork framing fixes ─────────────
   a) Homepage cards: percentage height did not resolve inside a grid <figure>, so
      "contain" artwork was silently cropped (e.g. the awareness poster lost its headline).
      Absolute fill makes the frame behave exactly like the archive tiles.
   b) Archive tile arrow was white on a white disc (invisible). */
.editorial-home-card figure { display: block; position: relative; }
.editorial-home-card figure > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.portfolio-tile .work-arrow { color: #17131e; }
.portfolio-tile:hover .work-arrow, .portfolio-tile:focus-visible .work-arrow { color: #fff; }

/* ───────────── 14. Enquiry form button ─────────────
   v18 rendered the submit button white on the white form card, so it looked like plain text. */
.project-enquiry .form-submit { background: #17131e; color: #fff; justify-content: center; width: 100%; }
.project-enquiry .form-submit span { color: #b6a5ff; }
.project-enquiry .form-submit:hover:not(:disabled) { background: #7956f4; color: #fff; }
.project-enquiry .form-submit:hover:not(:disabled) span { color: #fff; }

/* Dark theme: the enquiry card stayed white while its text turned light (headline unreadable). */
:root[data-theme="dark"] .project-enquiry { background: #14131a; border-color: rgba(255, 255, 255, .1); box-shadow: 0 22px 70px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .project-enquiry :is(h2, h3, legend, label) { color: #f4f2f8; }
:root[data-theme="dark"] .project-enquiry :is(p, small) { color: #aaa5b3; }
:root[data-theme="dark"] .project-enquiry .form-submit { background: #f7f6fa; color: #17131e; }
:root[data-theme="dark"] .project-enquiry .form-submit span { color: #7956f4; }
:root[data-theme="dark"] .project-enquiry .form-submit:hover:not(:disabled) { background: #7956f4; color: #fff; }
:root[data-theme="dark"] .project-enquiry .form-submit:hover:not(:disabled) span { color: #fff; }

/* Outspace 2.2 — simplified archive filters and studio stats */
.filter-bar{gap:12px;align-items:center}
.filter-button{font-size:13px;padding:12px 19px;letter-spacing:0}
.filter-count{font-size:11px;margin-left:8px;opacity:.65}
.filter-status{font-size:13px;color:var(--muted,#88838e);margin:0 0 28px}
.studio-stats{padding:92px 0 100px;overflow:hidden}
.studio-stats-inner{display:grid;grid-template-columns:1fr 1.15fr;gap:8vw;align-items:end}
.studio-stats-heading h2{font-size:clamp(46px,6vw,78px);line-height:.98;letter-spacing:-.065em;margin:24px 0 0}
.studio-stats-heading h2 .serif{font-family:Georgia,serif;font-weight:400;font-style:italic;color:#a997ff}
.studio-stats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:28px;border-top:1px solid rgba(255,255,255,.2);padding-top:28px}
.studio-stat{display:flex;flex-direction:column;gap:12px}
.studio-stat strong{font-size:clamp(58px,8vw,104px);line-height:.9;letter-spacing:-.075em;font-weight:600;color:#a997ff}
.studio-stat span{font-size:16px;color:rgba(255,255,255,.76)}
@media(max-width:700px){.studio-stats{padding:70px 0}.studio-stats-inner{grid-template-columns:1fr;gap:38px}.studio-stats-heading h2{font-size:clamp(44px,12vw,64px)}.studio-stats-grid{gap:18px;padding-top:22px}.studio-stat strong{font-size:clamp(54px,15vw,76px)}.studio-stat span{font-size:14px}.filter-button{font-size:12px;padding:10px 14px}}

/* Portfolio curation: SGF grouped as one project */
.sgf-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin-top:48px}.sgf-gallery figure{margin:0;background:#e8e6e9;border-radius:12px;overflow:hidden}.sgf-gallery img{display:block;width:100%;height:auto;object-fit:contain}.filter-button{font-size:12px;letter-spacing:0}.filter-count{display:none!important}.filter-status{font-size:12px;color:var(--muted,#85818b)}@media(max-width:600px){.sgf-gallery{grid-template-columns:1fr;gap:16px}}

/* v2.5 corrections: SGF gallery images are individually viewable without creating extra portfolio cards. */
.sgf-gallery .sgf-image-link{display:block;line-height:0;cursor:zoom-in}
.sgf-gallery .sgf-image-link:focus-visible{outline:2px solid var(--accent,#8f78ff);outline-offset:4px}

/* SGF project gallery viewer */
.sgf-viewer[hidden]{display:none!important}.sgf-viewer{position:fixed;inset:0;z-index:9999;display:grid;grid-template-columns:64px minmax(0,1fr) 64px;align-items:center;gap:16px;padding:5vh 4vw;background:rgba(7,7,11,.96);backdrop-filter:blur(14px)}.sgf-viewer figure{margin:0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;height:100%}.sgf-viewer-image{display:block;max-width:100%;max-height:82vh;width:auto;height:auto;object-fit:contain;border-radius:8px;box-shadow:0 24px 90px rgba(0,0,0,.4)}.sgf-viewer-count{color:#d8d4e2;font:12px/1.4 Inter,Arial,sans-serif;letter-spacing:.08em}.sgf-viewer-close,.sgf-viewer-nav{border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.08);color:#fff;border-radius:50%;width:48px;height:48px;font-size:25px;cursor:pointer}.sgf-viewer-close{position:absolute;right:28px;top:24px}.sgf-viewer-nav{justify-self:center}.sgf-viewer button:hover{background:rgba(255,255,255,.18)}body.sgf-viewer-open{overflow:hidden}@media(max-width:640px){.sgf-viewer{grid-template-columns:42px minmax(0,1fr) 42px;gap:6px;padding:64px 10px 24px}.sgf-viewer-image{max-width:100%;max-height:76vh}.sgf-viewer-close{right:14px;top:12px;width:42px;height:42px}.sgf-viewer-nav{width:38px;height:38px;font-size:20px}}
