:root {
  --ink: #111111;
  --ink-soft: #6b6b6b;
  --hairline: rgba(17, 17, 17, 0.14);
  --tone-matrix: #d7e6f5;
  --tone-literature: #dcefe0;
  --tone-people: #e2e6ea;
  --tone-workflow: #f8edcf;
  --tone-samples: #f6ddd2;
  --tone-referencemap: #f1e9d2;
  --tone-mex: #dbe8d4;
  --tone-about: #e5dcf5;
  --tone-contact: #f1dbe4;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #ffffff;
  color: var(--ink);
  font-family: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

/* ---------- Page column ---------- */

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
  padding: 40px 24px;
}

.page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.72)),
    url('../assets/Baner.png') center / cover no-repeat;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

body.cat-respace .page::before {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.72)),
    url('../assets/Baner1.png');
}

.page > * {
  position: relative;
  z-index: 1;
}

/* Banner is dark, so title/nav read in light text while it's showing
   (i.e. whenever the page isn't in the SPA's "active" panel-open state,
   where the banner fades out to a plain white background instead). */
body:not(.active) .site-title {
  color: #ffffff;
}

body:not(.active) .nav-btn {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

body:not(.active) .nav-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

body.active .page {
  justify-content: flex-start;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

body.active .page::before {
  opacity: 0;
}

/* Re-Space keeps its hero banner behind the compact header/nav even
   once a section is open (other categories fade it out to plain white
   there), so the header/nav text needs to stay light in that state too. */
body.active.cat-respace .page::before {
  opacity: 1;
}

body.active.cat-respace .site-header {
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

body.active.cat-respace .site-title-main {
  color: #ffffff;
}

body.active.cat-respace .nav-btn {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

body.active.cat-respace .nav-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- Title ---------- */

.site-header {
  order: -1;
  text-align: center;
  padding: 0 24px 56px;
  width: 100%;
}

.site-title {
  display: block;
}

.site-title-main {
  display: block;
  font-size: clamp(30px, 4.6vw, 54px);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
  transition: font-size 0.45s cubic-bezier(0.65, 0, 0.35, 1), letter-spacing 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.site-title-sub {
  display: block;
  margin-top: 10px;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: font-size 0.45s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.3s ease;
}

body:not(.active) .site-title-sub {
  color: rgba(255, 255, 255, 0.75);
}

body.active .site-header {
  padding: 22px 28px;
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}

body.active .site-title-main {
  font-size: 15px;
  letter-spacing: 0.02em;
}

body.active .site-title-sub {
  display: none;
}

/* ---------- Nav buttons (shared list) ---------- */

.nav-btn {
  order: 0;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: none;
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 14px 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: max-width 0.5s cubic-bezier(0.65, 0, 0.35, 1),
              padding 0.4s ease,
              font-size 0.4s ease,
              color 0.25s ease,
              border-color 0.25s ease,
              background 0.25s ease;
}

.nav-btn:hover {
  color: var(--ink-soft);
}

body.active .nav-btn {
  max-width: none;
  padding: 8px 24px;
  font-size: 11px;
}

.nav-btn.is-current {
  color: var(--ink);
  background: rgba(17, 17, 17, 0.03);
}

/* ---------- Content panel ---------- */

.content-panel {
  order: 999;
  width: 100%;
  flex: 0 0 auto;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scaleY(0.04);
  transform-origin: 50% 50%;
  transition: opacity 0.35s ease, background 0.4s ease;
  pointer-events: none;
}

body.active .content-panel.is-open {
  flex: 1 1 auto;
  height: auto;
  min-height: 140px;
  opacity: 1;
  transform: scaleY(1);
  transition: transform 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.05s,
              opacity 0.4s ease 0.05s,
              background 0.4s ease;
  pointer-events: auto;
}

.content-panel[data-tone="matrix"] { background: var(--tone-matrix); }
.content-panel[data-tone="literature"] { background: var(--tone-literature); }
.content-panel[data-tone="people"] { background: var(--tone-people); }
.content-panel[data-tone="workflow"] { background: var(--tone-workflow); }
.content-panel[data-tone="samples"] { background: var(--tone-samples); }
.content-panel[data-tone="referencemap"] { background: var(--tone-referencemap); }
.content-panel[data-tone="mex"] { background: var(--tone-mex); }
.content-panel[data-tone="about"] { background: var(--tone-about); }
.content-panel[data-tone="contact"] { background: var(--tone-contact); }
.content-panel.has-diagram { background: #ffffff; }

.panel-label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease 0.35s;
}

.content-panel.is-open .panel-label {
  opacity: 1;
}

/* ---------- Reference map frame ---------- */

.referencemap-frame {
  width: 100%;
  align-self: stretch;
  border: none;
  display: block;
}

/* ---------- Icon dock (page/category shortcuts) ---------- */

.icon-dock {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: flex;
  gap: 10px;
}

.icon-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.icon-fab:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.icon-fab svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 1.5;
}

@media (max-width: 640px) {
  .site-title-main { font-size: clamp(22px, 7.5vw, 32px); }
  .site-title-sub { font-size: clamp(11px, 3vw, 13px); }
  body.active .site-title-main { font-size: 12px; }
  .nav-btn { font-size: 12px; padding: 13px 4px; }
  body.active .nav-btn { padding: 7px 16px; font-size: 10px; }
  .icon-dock { right: 16px; bottom: 16px; gap: 8px; }
  .icon-fab { width: 40px; height: 40px; }
}
