/* ==========================================================================
   SPIRAL — Sonic Production Intelligence Research and Applications Lab
   Unified stylesheet. Design language: an instrument panel rendered as a
   printed spec sheet — graph-paper surface, hairline frequency-tick rules,
   and the lab's own signal yellow + ink, carried over from the original
   spiral mark, with the namesake spiral drawn as a decaying signal envelope.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  /* -- color: named tokens -- */
  --paper:      #faf7ec;
  --paper-raised: #fffdf6;
  --ink:        #14120a;
  --ink-soft:   #514c3c;
  --line:       #ddd6bd;
  --yellow:     #ffd100;   /* the lab's signal yellow: decorative use (graphics, fills) */
  --yellow-text: #7a5f00;  /* AA-contrast yellow for links/eyebrows on paper */
  --yellow-dim: #fff0b3;
  --panel:      #14120a;   /* dark instrument panel — footer, inverted blocks */
  --panel-line: #3a3626;
  --panel-text: #f4f0e2;

  --font-display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;

  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
[id]{ scroll-margin-top: 90px; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img{ max-width: 100%; display: block; }
a{ color: inherit; }
:focus-visible{ outline: 2px solid var(--ink); outline-offset: 3px; }

h1, h2, h3, h4{
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.01em;
}

p{ margin: 0 0 1em; }
p:last-child{ margin-bottom: 0; }

.wrap{
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow-text);
}
.eyebrow::before{
  content: "";
  width: 1.1em;
  height: 1px;
  background: currentColor;
}

.section-label{
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* -- frequency-tick divider: the recurring structural motif. a hairline
   rule with tick marks, like the frequency axis of a spectrum analyzer --  */
.tick-rule{
  position: relative;
  height: 1px;
  background: var(--line);
  margin: 0;
  overflow: visible;
}
.tick-rule::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to right, var(--line) 0 1px, transparent 1px 48px
  );
  height: 7px;
  top: -3px;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 236, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  border-top: 4px solid var(--yellow);
}
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}
.brand{
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brand svg{ width: 30px; height: 30px; flex: none; }
.brand .brand-text{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.brand .brand-sub{
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.site-nav{ display: flex; align-items: center; gap: 1.9rem; }
.site-nav a{
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover{ color: var(--ink); }
.site-nav a[aria-current="page"]{
  color: var(--ink);
  border-bottom-color: var(--yellow);
}

.nav-toggle{
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after{
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span::before{ position: absolute; top: -6px; }
.nav-toggle span::after{ position: absolute; top: 6px; }
.nav-open .nav-toggle span{ background: transparent; }
.nav-open .nav-toggle span::before{ transform: translateY(6px) rotate(45deg); top: 0; }
.nav-open .nav-toggle span::after{ transform: translateY(-6px) rotate(-45deg); top: 0; }

@media (max-width: 780px){
  .nav-toggle{ display: inline-flex; }
  .site-nav{
    position: fixed;
    inset: 65px 0 0 0;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem var(--gutter) 2rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    border-bottom: 1px solid var(--line);
  }
  .nav-open .site-nav{ opacity: 1; transform: translateY(0); pointer-events: auto; }
  .site-nav a{
    width: 100%;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
  }
}

/* ==========================================================================
   Hero (home)
   ========================================================================== */
.hero{
  padding-block: clamp(2.5rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem);
}
.hero-grid{
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero h1{
  font-size: clamp(2.6rem, 5.6vw, 4.6rem);
  margin-block: 0.5rem 1.1rem;
}
.hero .lede{
  font-size: 1.1rem;
  max-width: 46ch;
  color: var(--ink-soft);
}
.hero-meta{
  margin-top: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.hero-art{
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  border-radius: 50%;
  padding: 12%;
}
.hero-art svg{ width: 100%; height: 100%; }
.spiral-path{
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spiral-path.signal{ stroke: var(--ink); }

@media (max-width: 860px){
  .hero-grid{ grid-template-columns: 1fr; }
  .hero-art{ order: -1; max-width: 260px; margin-inline: auto; }
}

/* ==========================================================================
   Buttons / links
   ========================================================================== */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
  padding: 0.7em 1.2em;
  border: 1px solid var(--ink);
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover{ background: var(--ink); color: var(--paper); }
.btn.btn-accent{ background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.btn.btn-accent:hover{ background: var(--ink); border-color: var(--ink); color: var(--yellow); }

.text-link{
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  color: var(--yellow-text);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--yellow-dim);
}
.text-link:hover{ border-bottom-color: var(--yellow-text); }
.text-link::after{ content: "→"; font-size: 0.9em; transition: transform 0.15s ease; }
.text-link:hover::after{ transform: translateX(2px); }

/* ==========================================================================
   Sections / generic layout
   ========================================================================== */
main{ display: block; }
.section{ padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-head{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.6rem);
}
.section-head h2{ font-size: clamp(1.7rem, 3.4vw, 2.4rem); }

.page-intro{
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2rem);
}
.page-intro h1{ font-size: clamp(2.1rem, 4.6vw, 3.2rem); margin-block: 0.5rem 1rem; }
.page-intro .lede{ max-width: 62ch; color: var(--ink-soft); font-size: 1.05rem; }

/* two-column feature row, alternating */
.feature{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}
.feature.reverse .feature-media{ order: 2; }
.feature-media img{
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.feature-body h3{ font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.feature-body p{ color: var(--ink-soft); margin-block: 0.9rem 1.2rem; }
.feature-links{ display: flex; flex-wrap: wrap; gap: 1.2rem 1.6rem; }

@media (max-width: 780px){
  .feature{ grid-template-columns: 1fr; }
  .feature.reverse .feature-media{ order: 0; }
}

/* ==========================================================================
   Cards: people / research grid
   ========================================================================== */
.grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.6rem;
}
.person-card{ display: flex; flex-direction: column; }
.person-photo{
  aspect-ratio: 4/5;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
}
.person-photo img{ width: 100%; height: 100%; object-fit: cover; }
.person-card h3{
  font-size: 1.05rem;
  margin-top: 0.9rem;
}
.person-card p{
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 0.35rem;
}

.research-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.research-card{
  background: var(--paper);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
}
.research-card .section-label{ margin-bottom: 0.7rem; }
.research-card h3{ font-size: 1.12rem; margin-bottom: 0.6rem; }
.research-card p{
  color: var(--ink-soft);
  font-size: 0.93rem;
  flex-grow: 1;
}
.research-card .research-links{
  margin-top: 1rem;
  display: flex;
  gap: 1.2rem;
  font-size: 0.82rem;
}

.research-card.flagship{
  grid-column: span 2;
  background: var(--paper-raised);
  box-shadow: inset 4px 0 0 var(--yellow);
}
@media (max-width: 700px){
  .research-card.flagship{ grid-column: span 1; }
}

/* ==========================================================================
   Tools & Apps — vertical stack, screenshot in window chrome
   ========================================================================== */
.app-row{
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2.4rem, 6vw, 4rem);
}
.app-row.reverse{ direction: rtl; }
.app-row.reverse > *{ direction: ltr; }

.app-id{ display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.app-logo{
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  flex: none;
}
.app-logo img{ width: 100%; height: 100%; object-fit: cover; }
.app-id h3{ font-size: 1.5rem; }
.app-id .section-label{ display: block; margin-top: 0.2rem; }

.app-desc{ color: var(--ink-soft); margin-bottom: 1.2rem; max-width: 52ch; }
.app-links{ display: flex; flex-wrap: wrap; gap: 0.9rem 1.4rem; align-items: center; }

.app-shot{
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: 0 18px 40px -22px rgba(20, 25, 26, 0.35);
  overflow: hidden;
}
.app-shot .chrome{
  display: flex;
  gap: 6px;
  padding: 9px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.app-shot .chrome span{
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
}
.app-shot img{ width: 100%; display: block; }

@media (max-width: 820px){
  .app-row, .app-row.reverse{ grid-template-columns: 1fr; direction: ltr; }
}

/* ==========================================================================
   Facilities
   ========================================================================== */
.facility-list .feature:not(:last-child){ border-bottom: 1px solid var(--line); }
.spec-list{
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.35rem;
}
.spec-list li::before{ content: "· "; color: var(--yellow-text); }

/* ==========================================================================
   PlayBook gallery
   ========================================================================== */
.gallery{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.gallery img{
  width: 100%;
  height: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 3px;
}
.gallery a.gallery-wide{ grid-column: span 2; }
@media (max-width: 700px){
  .gallery{ grid-template-columns: repeat(2, 1fr); }
  .gallery a.gallery-wide{ grid-column: span 2; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer{
  background: var(--panel);
  color: var(--panel-text);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.6rem;
  margin-top: clamp(3rem, 7vw, 5rem);
}
.footer-top{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--panel-line);
}
.footer-brand .brand-text{ color: var(--panel-text); font-size: 1.2rem; }
.footer-brand .brand-sub{ color: #a39c88; }
.footer-address{
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #c2bca6;
  line-height: 1.8;
}
.footer-address a{ color: var(--yellow); text-decoration: none; }

.footer-partners{
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding-block: 1.8rem;
}
.footer-partners a, .footer-partners span{
  background: var(--paper-raised);
  border-radius: 5px;
  padding: 0.7rem 1.1rem;
  display: inline-flex;
  align-items: center;
  height: 46px;
}
.footer-partners img{ max-height: 26px; width: auto; }

.footer-bottom{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #948e78;
  padding-top: 1.2rem;
}
.footer-bottom a{ color: #948e78; }
.footer-bottom a:hover{ color: var(--panel-text); }

/* ==========================================================================
   Utility
   ========================================================================== */
.visually-hidden{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
