:root {
    /* Rise brand palette */
    --ink: #102A2C;          /* Deep Midnight Green — primary anchor */
    --ink-2: #1B1B1B;        /* Charcoal Ink — body text */
    --teal: #2B7A78;         /* Horizon Teal — secondary */
    --mint: #8FBFBD;         /* (unused, kept for legacy) */
    --terra: #F47B20;        /* Sunrise Orange — accent/CTA */
    --amber: #F7B347;        /* Golden Glow — warm highlights */
    --paper: #F8F6F2;        /* Warm White — primary bg */
    --paper-2: #EAE4DA;      /* Soft Sand — section breaks */
    --line: #102A2C;
    --line-soft: rgba(16, 42, 44, 0.18);
    --muted: rgba(16, 42, 44, 0.62);

    /* Typography */
    --f-display: "Fraunces", "Cormorant Garamond", "Quincy CF", Georgia, serif;
    --f-body: "Satoshi", "General Sans", system-ui, sans-serif;
    --f-label: "Satoshi", "General Sans", system-ui, sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, monospace;
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: var(--f-body);
    color: var(--ink-2);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* ---------- App shell / tabs ---------- */
  .app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    gap: 24px;
  }
  .topbar .brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--f-label);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .topbar .brand img { height: 26px; width: auto; display: block; }
  .topbar .brand span { color: var(--muted); }
  .tabs {
    display: flex;
    gap: 4px;
    background: var(--paper-2);
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .tab {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 8px 18px;
    border-radius: 999px;
    font-family: var(--f-label);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .tab:hover { background: rgba(31,58,56,0.08); }
  .tab.is-active {
    background: var(--ink);
    color: var(--paper);
  }
  .meta {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--muted);
  }

  /* ---------- Wireframe canvas ---------- */
  .canvas {
    flex: 1;
    background: var(--paper);
  }
  .frame {
    max-width: 1320px;
    margin: 0 auto;
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    background: var(--paper);
  }

  /* ---------- Common wireframe primitives ---------- */
  .label {
    font-family: var(--f-label);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .label--ink { color: var(--ink); }
  .mono {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.02em;
  }
  .display {
    font-family: var(--f-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 0.96;
  }
  .body { font-family: var(--f-body); font-size: 16px; line-height: 1.55; color: var(--ink-2); }
  .body--lg { font-size: 19px; line-height: 1.5; }
  .body--sm { font-size: 14px; line-height: 1.55; color: rgba(16,42,44,0.78); }

  .rule { height: 1px; background: var(--line); width: 100%; }
  .rule--soft { background: var(--line-soft); }

  .btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 16px 26px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    font-family: var(--f-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, transform 0.15s;
  }
  .btn .arrow { width: 18px; height: 1px; background: currentColor; position: relative; }
  .btn .arrow::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-right: 1px solid currentColor; border-top: 1px solid currentColor; transform: rotate(45deg); }
  .btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .btn--solid:hover { background: var(--terra); border-color: var(--terra); }
  .btn:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(16,42,44,0.4); }
  .btn--solid:hover { background: var(--terra); color: var(--paper); transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(244,123,32,0.5); }

  /* card primitive — premium SaaS rounded corners */
  .card {
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: var(--paper);
    overflow: hidden;
  }
  .card--soft { background: var(--paper-2); border-color: var(--line-soft); }
  .card--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }

  /* input primitive */
  .input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: var(--paper);
    font-family: var(--f-body);
    font-size: 14px;
    color: var(--ink);
    transition: border-color 0.15s;
  }
  .input:focus { outline: none; border-color: var(--terra); }

  /* placeholder image */
  .ph {
    position: relative;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background-image: repeating-linear-gradient(
      135deg,
      transparent 0 9px,
      rgba(16,42,44,0.08) 9px 10px
    );
    background-color: var(--paper-2);
    overflow: hidden;
  }
  .ph__tag {
    position: absolute;
    left: 12px; top: 12px;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    padding: 4px 8px;
    text-transform: uppercase;
  }
  .ph__corner {
    position: absolute;
    right: 8px; bottom: 8px;
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--muted);
  }
  .ph--dark {
    background-color: var(--ink);
    background-image: repeating-linear-gradient(135deg, transparent 0 9px, rgba(248,246,242,0.10) 9px 10px);
    border-color: var(--ink);
  }
  .ph--dark .ph__tag { background: var(--ink); color: var(--paper); border-color: var(--paper); }
  .ph--dark .ph__corner { color: rgba(248,246,242,0.6); }

  /* annotation chip */
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px dashed var(--line-soft);
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--terra); }

  /* ---------- A: editorial / sparse ---------- */
  .secA {
    padding: 110px 64px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  .secA__num {
    position: absolute;
    top: 28px; left: 28px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.08em;
  }
  .secA__name {
    position: absolute;
    top: 28px; right: 28px;
    font-family: var(--f-label);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* ---------- B: dense / info-rich ---------- */
  .secB {
    display: grid;
    grid-template-columns: 180px 1fr;
    border-bottom: 1px solid var(--line);
  }
  .secB__rail {
    border-right: 1px solid var(--line);
    padding: 28px 20px;
    background: var(--paper);
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .secB__rail .num {
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--ink);
  }
  .secB__rail .name {
    font-family: var(--f-label);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .secB__rail .meta-line {
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--muted);
    line-height: 1.6;
    margin-top: auto;
  }
  .secB__main { padding: 36px 40px; }

  /* ---------- shared layout helpers ---------- */
  .stack-12 > * + * { margin-top: 12px; }
  .stack-16 > * + * { margin-top: 16px; }
  .stack-24 > * + * { margin-top: 24px; }
  .stack-32 > * + * { margin-top: 32px; }
  .stack-48 > * + * { margin-top: 48px; }

  .row { display: flex; gap: 16px; flex-wrap: wrap; }

  /* nav (used in both, slightly different styling controlled inline) */
  .nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 32px;
    border-bottom: 1px solid var(--line-soft);
    gap: 32px;
    background: var(--paper);
  }
  .nav__logo { display: flex; align-items: center; gap: 10px; }
  .nav__logo img { height: 38px; width: auto; }
  .nav__links { display: flex; gap: 28px; }
  .nav__links a {
    font-family: var(--f-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
    text-decoration: none;
    position: relative;
    transition: color 0.15s;
  }
  .nav__links a:hover { color: var(--terra); }
  .nav__links a::after {
    content: "";
    position: absolute;
    left: 0; bottom: -6px;
    height: 2px; width: 0;
    background: var(--terra);
    transition: width 0.2s ease;
    border-radius: 1px;
  }
  .nav__links a:hover::after { width: 100%; }
  .nav__links a[aria-current="page"] { color: var(--terra); }
  .nav__links a[aria-current="page"]::after { width: 100%; }

  /* hover state legend */
  .hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--muted);
    border: 1px dashed var(--line-soft);
    padding: 3px 8px;
  }
  .hint .arrow-r { display: inline-block; width: 12px; border-top: 1px dashed var(--muted); position: relative; height: 1px; }

  /* marquee */
  .marquee {
    display: flex;
    gap: 64px;
    white-space: nowrap;
    animation: marquee 35s linear infinite;
    font-family: var(--f-display);
    font-size: 84px;
    line-height: 1;
    color: var(--ink);
  }
  .marquee span { display: inline-flex; align-items: center; gap: 32px; }
  .marquee em { font-style: italic; color: var(--terra); }
  .marquee .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); display: inline-block; }
  @keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
  }
  .marquee-wrap { overflow: hidden; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

  /* utility */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
  .grid-3 > * { border-right: 1px solid var(--line); padding: 28px 24px; }
  .grid-3 > *:last-child { border-right: 0; }

  .grid-services {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
  }
  .grid-services > * {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 28px 24px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    transition: background 0.15s;
  }
  .grid-services > *:nth-child(3n) { border-right: 0; }
  .grid-services > *:hover { background: var(--paper-2); }
  .grid-services > *:hover .svc__plus { background: var(--terra); color: var(--paper); border-color: var(--terra); }
  .svc__num {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--muted);
  }
  .svc__title {
    font-family: var(--f-display);
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.01em;
  }
  .svc__plus {
    position: absolute;
    top: 24px; right: 24px;
    width: 28px; height: 28px;
    border: 1px solid var(--line);
    display: grid; place-items: center;
    font-family: var(--f-mono);
    font-size: 14px;
    transition: all 0.15s;
  }

  /* tweaks panel customization */
  .tweak-radio--font label {
    font-family: var(--f-label);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 10px;
  }

  /* dot grid background for hero */
  .dotgrid {
    background-image: radial-gradient(rgba(16,42,44,0.18) 1px, transparent 1px);
    background-size: 22px 22px;
  }

  /* the accent strip */
  .accent-strip {
    height: 6px;
    background: var(--terra);
  }

  /* big numbered KPI */
  .kpi {
    display: flex;
    align-items: baseline;
    gap: 14px;
  }
  .kpi__num {
    font-family: var(--f-display);
    font-size: 64px;
    line-height: 0.9;
    letter-spacing: -0.02em;
  }
  .kpi__label {
    font-family: var(--f-label);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* checkbox bullet */
  .chk {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
    align-items: start;
  }
  .chk__box {
    width: 16px; height: 16px;
    border: 1px solid var(--ink);
    margin-top: 4px;
    position: relative;
  }
  .chk__box::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--terra);
  }

  /* dark section */
  .dark {
    background: var(--ink);
    color: var(--paper);
  }
  .dark .label, .dark .body--sm, .dark .mono, .dark .muted { color: rgba(248,246,242,0.7); }
  .dark .rule { background: rgba(248,246,242,0.2); }
  .dark .btn { color: var(--paper); border-color: var(--paper); }
  .dark .btn:hover { background: var(--paper); color: var(--ink); }
  .dark .btn--solid { background: var(--terra); border-color: var(--terra); color: var(--paper); }
  .dark .ph { background-color: rgba(248,246,242,0.05); border-color: rgba(248,246,242,0.3); background-image: repeating-linear-gradient(135deg, transparent 0 9px, rgba(248,246,242,0.10) 9px 10px); }
  .dark .ph__tag { background: var(--ink); color: var(--paper); border-color: var(--paper); }
  .dark .ph__corner { color: rgba(248,246,242,0.6); }
  .dark .secA__num, .dark .secA__name { color: rgba(248,246,242,0.6); }
  .dark .chk__box { border-color: var(--paper); }

  /* annotation lines (sketch hover state) */
  .anno {
    position: absolute;
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--terra);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
  }
  .anno::before {
    content: "";
    width: 24px; height: 1px; background: var(--terra);
  }

  /* footer */
  .foot {
    padding: 64px 64px 40px;
    border-top: 1px solid var(--line-soft);
    background: var(--paper);
  }
  .foot .row-top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 48px;
  }
  .foot .col h4 {
    font-family: var(--f-label);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 14px;
    color: var(--muted);
  }
  .foot .col a {
    display: block;
    font-family: var(--f-body);
    font-size: 14px;
    color: var(--ink);
    text-decoration: none;
    padding: 4px 0;
  }
  .foot .col a:hover { color: var(--terra); }
  .foot .row-bot {
    display: flex; justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--line-soft);
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--muted);
  }

  /* tab content fade */
  .tab-content { animation: fade 0.25s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

  /* underline link */
  .ulink {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
  }
  .ulink:hover { color: var(--terra); }

/* ---------- System diagram cross-fade cycle ---------- */
.system-cycle {
  position: relative;
  width: 100%;
  aspect-ratio: 474 / 576;
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line-soft);
}
.system-cycle img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  animation: system-cycle-fade 9.6s infinite;
  /* image-rendering keeps PNG text crisp under transform */
  image-rendering: auto;
}
@keyframes system-cycle-fade {
  /* 6 frames over 9.6s — each frame visible ~1.4s, ~0.2s crossfade */
  0%   { opacity: 0; }
  2%   { opacity: 1; }
  16.6%{ opacity: 1; }
  18.6%{ opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .system-cycle img { animation: none; opacity: 1; }
  .system-cycle img:not(:first-child) { display: none; }
}


/* ---------- Brand moment thumbnails + lightbox ---------- */
.bm-thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 180px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--paper-2);
  overflow: hidden;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.bm-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.5s ease;
}
.bm-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -16px rgba(16, 42, 44, 0.25);
  border-color: var(--ink);
}
.bm-thumb:hover img {
  transform: scale(1.04);
}
.bm-thumb:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}
.bm-thumb__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  background: linear-gradient(180deg, rgba(16,42,44,0) 40%, rgba(16,42,44,0.55) 100%);
  pointer-events: none;
}
.bm-thumb__zoom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-label);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.bm-thumb:hover .bm-thumb__zoom,
.bm-thumb:focus-visible .bm-thumb__zoom {
  opacity: 1;
  transform: translateY(0);
}
.bm-thumb__label {
  font-family: var(--f-label);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--paper);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.bm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(16, 42, 44, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 16px;
  overflow-y: auto;
  animation: bm-fade 0.2s ease;
}
@keyframes bm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.bm-lightbox__close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(245, 241, 234, 0.3);
  background: rgba(16, 42, 44, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease, transform 0.2s ease;
}
.bm-lightbox__close:hover {
  background: var(--terra);
  border-color: var(--terra);
  transform: rotate(90deg);
}
.bm-lightbox__stage {
  max-width: min(680px, 100%);
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
  margin-bottom: 16px;
  flex-shrink: 0;
}
.bm-lightbox__stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
}
.bm-lightbox__caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px 24px;
  color: var(--paper);
  text-align: center;
  font-size: 14px;
}
.bm-lightbox__caption .mono {
  color: rgba(245, 241, 234, 0.65);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
