@import url('assets/design-tokens.css');

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
ul { list-style: none; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ─── Base ───────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--tenseq-font-sans);
  font-size: var(--tenseq-size-body);
  background-color: var(--tenseq-near-black);
  color: var(--tenseq-reversed);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Light sections */
#about,
#principles,
#contact {
  background-color: var(--tenseq-paper);
  color: var(--tenseq-ink);
}

/* ─── Kicker ─────────────────────────────────────────────────────── */
.kicker {
  font-family: var(--tenseq-font-mono);
  font-size: var(--tenseq-size-kicker);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tenseq-accent);
  margin-bottom: 0.75rem;
}

/* ─── Section shared ─────────────────────────────────────────────── */
.section-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 96px 24px;
}

.section-heading { margin-bottom: 56px; }

.section-heading h2 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 0.25rem;
}

/* ─── Primary button ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background-color: var(--tenseq-accent);
  color: var(--tenseq-reversed);
  padding: 11px 22px;
  border-radius: 6px;
  font-family: var(--tenseq-font-sans);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s;
  border: none;
}

.btn-primary:hover { background-color: var(--tenseq-accent-strong); }

/* ─── Focus rings ────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--tenseq-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ─── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── Navigation ─────────────────────────────────────────────────── */
#site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(16, 16, 19, 0.88);
  border-bottom: 1px solid rgba(240, 240, 238, 0.07);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo img { height: 28px; width: auto; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a:not(.btn-primary) {
  font-weight: 500;
  font-size: 15px;
  color: rgba(240, 240, 238, 0.75);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:not(.btn-primary):hover { color: var(--tenseq-reversed); }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  color: var(--tenseq-reversed);
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
}

/* Mobile overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--tenseq-near-black);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.nav-overlay.is-open { display: flex; }

.nav-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  color: rgba(240, 240, 238, 0.7);
  padding: 8px;
}

.nav-close:hover { color: var(--tenseq-reversed); }

.nav-overlay-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.nav-overlay-links a:not(.btn-primary) {
  font-size: 22px;
  font-weight: 500;
  color: var(--tenseq-reversed);
  text-decoration: none;
}

/* Responsive: show hamburger below 768px */
@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* ─── Hero ───────────────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Legibility wash: darken behind the text, let the field show on the right */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(16, 16, 19, 0.94) 0%, rgba(16, 16, 19, 0.7) 38%, rgba(16, 16, 19, 0.1) 100%),
    linear-gradient(0deg, rgba(16, 16, 19, 0.85) 0%, rgba(16, 16, 19, 0) 40%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 24px;
  width: 100%;
}

.hero-text { max-width: 600px; }

.hero-text h1 {
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--tenseq-reversed);
  margin-bottom: 24px;
}

.hero-body {
  font-size: 18px;
  color: rgba(240, 240, 238, 0.7);
  margin-bottom: 36px;
  line-height: 1.65;
}

#hero-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 767px) {
  /* On narrow screens the text sits over the whole field, so fade bottom-up */
  .hero-bg::after {
    background: linear-gradient(0deg, rgba(16, 16, 19, 0.92) 0%, rgba(16, 16, 19, 0.55) 60%, rgba(16, 16, 19, 0.3) 100%);
  }
}

/* ─── Services ───────────────────────────────────────────────────── */
#services { background-color: var(--tenseq-near-black); }

.services-hint {
  font-family: var(--tenseq-font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--tenseq-subtle);
  margin-bottom: 28px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  position: relative;     /* anchors Flip's absolutely positioned cards mid-morph */
}

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(227, 225, 220, 0.1);
  border-radius: var(--tenseq-radius-card);
  overflow: hidden;
  /* Fallback easing for when GSAP Flip is unavailable; Flip drives the real
     stage-and-rail motion when it loads. */
  transition: opacity 0.4s ease, border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Equal idle heights so no card reads smaller than its neighbours. */
.services-grid:not(.has-active) .service-card { min-height: 172px; }

.service-card:hover { border-color: rgba(227, 225, 220, 0.2); }

/* ── Stage and rail: the focused card leads, the rest become side tiles. ── */
.services-grid.has-active {
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
}

.service-card.is-active {
  grid-column: 1;
  grid-row: 1 / 4;
  background-color: rgba(75, 87, 196, 0.05);
  border-color: rgba(75, 87, 196, 0.45);
  box-shadow: inset 3px 0 0 var(--tenseq-accent);
}

.service-card.is-tile {
  grid-column: 2;
  grid-row: var(--tile-row, auto);
  opacity: 0.45;
}

.service-card.is-tile:hover,
.service-card.is-tile:focus-within {
  opacity: 1;
  border-color: rgba(227, 225, 220, 0.28);
}

/* ── Clickable head ── */
.service-card-head {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  margin: 0;
  padding: 28px 30px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  position: relative;
  /* Top aligned so every title sits at the same height regardless of how many
     lines its summary wraps to. */
  justify-content: flex-start;
}

.service-title {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tenseq-accent);
  margin-bottom: 10px;
}

.service-summary {
  display: block;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(240, 240, 238, 0.62);
  max-width: 52ch;
}

/* Tiles show the title only, compact and top aligned. */
.service-card.is-tile .service-card-head { padding: 20px 22px; }
.service-card.is-tile .service-title { font-size: 16px; margin-bottom: 0; }
.service-card.is-tile .service-summary { display: none; }

/* Toggle: a plus that becomes an indigo cross on the active stage card. */
.service-toggle {
  position: absolute;
  top: 26px;
  right: 26px;
  width: 15px;
  height: 15px;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.25s ease;
}

.service-card:hover .service-toggle { opacity: 0.8; }
.service-card.is-active .service-toggle { opacity: 1; }
.service-card.is-tile .service-toggle { display: none; }

.service-toggle::before,
.service-toggle::after {
  content: '';
  position: absolute;
  background: var(--tenseq-subtle);
  transition: background 0.25s;
}

.service-toggle::before { top: 6.5px; left: 0; width: 15px; height: 2px; }
.service-toggle::after  { left: 6.5px; top: 0; width: 2px; height: 15px; }

.service-card.is-active .service-toggle { transform: rotate(45deg); }
.service-card.is-active .service-toggle::before,
.service-card.is-active .service-toggle::after { background: var(--tenseq-accent); }

/* ── Detail, rendered only on the active stage card. ── */
.service-card-detail { display: none; }
.service-card.is-active .service-card-detail { display: block; }

.service-card-detail-inner { padding: 4px 30px 30px; }

.service-card-detail p {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(240, 240, 238, 0.75);
  max-width: 70ch;
}

/* Space between consecutive body paragraphs in a detail panel. */
.service-card-detail-inner > p + p { margin-top: 14px; }

.service-list-label {
  font-family: var(--tenseq-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tenseq-subtle);
  margin-top: 24px;
  margin-bottom: 12px;
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.service-tags li {
  list-style: none;
  border: 1px solid rgba(227, 225, 220, 0.14);
  border-radius: 999px;
  padding: 5px 12px;
}

.service-tags code {
  font-family: var(--tenseq-font-mono);
  font-size: 12px;
  color: rgba(240, 240, 238, 0.78);
}

.service-built {
  font-size: 13px !important;
  color: var(--tenseq-subtle) !important;
}

.service-built code {
  font-family: var(--tenseq-font-mono);
  font-size: 12px;
  color: rgba(240, 240, 238, 0.7);
}

@media (min-width: 1280px) {
  .services-grid:not(.has-active) { grid-template-columns: repeat(4, 1fr); }
}

/* Below the rail breakpoint, drop the side rail and stack everything. */
@media (max-width: 767px) {
  .services-grid,
  .services-grid.has-active {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .service-card.is-active,
  .service-card.is-tile {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 479px) {
  .services-grid:not(.has-active) { grid-template-columns: 1fr; }
}

/* ─── About ──────────────────────────────────────────────────────── */
#about .kicker { color: var(--tenseq-accent); }

#about .section-heading h2 { color: var(--tenseq-ink); }

.about-body {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.about-body p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--tenseq-subtle);
}

/* Lead paragraph carries the positioning, set in ink and a touch larger. */
.about-lead {
  font-size: 21px !important;
  line-height: 1.55 !important;
  color: var(--tenseq-ink) !important;
  letter-spacing: -0.01em;
  max-width: 720px;
}

@media (max-width: 767px) {
  .about-lead { font-size: 19px !important; }
}

/* ─── Process ────────────────────────────────────────────────────── */
#process { background-color: var(--tenseq-near-black); }

.process-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.process-step {
  border-top: 1px solid rgba(240, 240, 238, 0.14);
  padding-top: 20px;
}

.process-num code {
  font-family: var(--tenseq-font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--tenseq-accent);
}

.process-step h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tenseq-reversed);
  margin: 14px 0 10px;
}

.process-step p {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(240, 240, 238, 0.6);
}

@media (max-width: 767px) {
  .process-steps { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
}

@media (max-width: 479px) {
  .process-steps { grid-template-columns: 1fr; }
}

/* ─── Principles ─────────────────────────────────────────────────── */
#principles .kicker { color: var(--tenseq-accent); }
#principles .section-heading h2 { color: var(--tenseq-ink); }

.principles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px 48px;
}

.principle-icon {
  display: block;
  width: 28px;
  height: 28px;
  color: var(--tenseq-ink);
  margin-bottom: 18px;
}

.principle h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tenseq-ink);
  margin-bottom: 10px;
}

.principle p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--tenseq-subtle);
  max-width: 460px;
}

@media (max-width: 767px) {
  .principles-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ─── Contact ────────────────────────────────────────────────────── */
#contact .kicker { color: var(--tenseq-accent); }
#contact .section-heading h2 { color: var(--tenseq-ink); }

.contact-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.contact-card {
  background-color: #fff;
  border: 1px solid var(--tenseq-hairline);
  border-radius: var(--tenseq-radius-card);
  padding: 36px;
}

.contact-email {
  display: block;
  font-family: var(--tenseq-font-mono);
  font-size: 18px;
  font-weight: 400;
  color: var(--tenseq-accent);
  text-decoration: none;
  margin-bottom: 16px;
  word-break: break-all;
  transition: color 0.15s;
}

.contact-email:hover {
  color: var(--tenseq-accent-strong);
  text-decoration: underline;
}

.contact-card > p:last-child {
  font-size: 15px;
  line-height: 1.65;
  color: var(--tenseq-subtle);
}

@media (max-width: 767px) {
  .contact-cards { grid-template-columns: 1fr; }
}

/* ─── Footer ─────────────────────────────────────────────────────── */
#site-footer {
  background-color: var(--tenseq-near-black);
  border-top: 1px solid rgba(227, 225, 220, 0.08);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy {
  font-size: 13px;
  color: rgba(240, 240, 238, 0.6);
}

.footer-domain code {
  font-family: var(--tenseq-font-mono);
  font-size: 13px;
  color: rgba(240, 240, 238, 0.55);
}

@media (max-width: 479px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
