/* ============================================================
   Tessera — marketing landing
   Pure CSS, no frameworks, no external requests.
   Palette canon follows the product diagrams:
   bg #F6F8FB · ink #16202E/#3E4C61/#66758C
   mint #0D9488 (offline/device) · amber #D97706 (network/server)
   red #DC2626 (revocation) · blue #0284C7 (audit)
   ============================================================ */

:root {
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --ink: #16202E;
  --ink-2: #3E4C61;
  --ink-3: #66758C;
  --line: #DCE3EC;
  --line-strong: #94A3B8;

  --mint: #0D9488;
  --mint-deep: #0B6E63;      /* AA-safe for small text on light bg */
  --mint-soft: #E3F6F1;
  --amber: #D97706;
  --amber-deep: #9A5B0B;     /* AA-safe */
  --amber-soft: #FDF1DE;
  --red: #DC2626;
  --red-deep: #B91C1C;
  --red-soft: #FCE9E9;
  --blue: #0284C7;
  --blue-deep: #02669A;      /* AA-safe */
  --blue-soft: #E3F2FB;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas,
               "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;
  --shadow-card: 0 1px 2px rgba(22, 32, 46, 0.05), 0 8px 28px rgba(22, 32, 46, 0.06);
}

/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  background-color: var(--bg);
  /* faint tessellation grid — the product's namesake texture */
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.10) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 0.5em; }

p { margin: 0 0 1em; }

a { color: var(--mint-deep); text-underline-offset: 3px; }
a:hover { color: var(--mint); }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- brand mark: the rotated tessera tile ---------- */

.tile {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--mint);
  transform: rotate(45deg);
  flex: none;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;          /* on narrow screens actions drop to a second row */
  align-items: center;
  gap: 10px 16px;
  min-height: 64px;
  padding: 8px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.logo:hover { color: var(--ink); }

.site-nav {
  display: flex;
  gap: 22px;
  margin-left: 8px;
}

.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover {
  color: var(--mint-deep);
  border-bottom-color: var(--mint);
}

/* external link in nav (docs) */
.nav-ext::after {
  content: "\2197";  /* ↗ */
  font-size: 0.78em;
  margin-left: 3px;
  color: var(--ink-3);
}
.nav-ext:hover::after { color: var(--mint-deep); }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-switch {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.lang-switch a, .lang-switch span {
  padding: 5px 10px;
  text-decoration: none;
  color: var(--ink-3);
}
.lang-switch span[aria-current="true"] {
  background: var(--ink);
  color: #FFFFFF;
  font-weight: 600;
}
.lang-switch a:hover { background: var(--mint-soft); color: var(--mint-deep); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  border-radius: 10px;
  padding: 14px 22px;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--mint);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.28);
}
.btn-primary:hover { background: var(--mint-deep); color: #FFFFFF; }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-small { font-size: 14px; padding: 9px 16px; }

/* ---------- hero ---------- */

.hero { padding: 56px 0 24px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mint-deep);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.eyebrow::after {
  content: "";
  flex: 1;
  max-width: 180px;
  border-top: 2px dashed var(--line-strong);
}

.hero h1 {
  font-size: clamp(34px, 6.2vw, 58px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  max-width: 17ch;
  margin-bottom: 24px;
}
.hero h1 em {
  font-style: normal;
  color: var(--mint);
}

.hero .lede {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-2);
  max-width: 56ch;
  margin-bottom: 32px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

/* ---------- figures (diagrams) ---------- */

.figure {
  margin: 36px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.figure img { width: 100%; }
.figure figcaption {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  padding: 10px 18px;
  border-top: 1px dashed var(--line);
  background: var(--bg);
}

/* On small screens diagrams scroll horizontally instead of shrinking
   into illegibility (same approach as the comparison table). */
@media (max-width: 719.98px) {
  /* grid/flex items default to min-width:auto and would be blown up
     by the 700px diagram instead of letting it scroll */
  .scenario, .scenario .figure { min-width: 0; }
  .fig-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* right-edge fade pinned to the scroller viewport (does not scroll
       with content) — signals there is more to the right */
    -webkit-mask-image: linear-gradient(to right,
      #000 calc(100% - 36px), rgba(0, 0, 0, 0.2) 100%);
    mask-image: linear-gradient(to right,
      #000 calc(100% - 36px), rgba(0, 0, 0, 0.2) 100%);
  }
  .fig-scroll img {
    width: 700px;
    min-width: 700px;
    max-width: none;
  }
  .figure figcaption::after {
    content: "листайте \2192";  /* → */
    margin-left: 10px;
    color: var(--mint-deep);
    white-space: nowrap;
  }
  :lang(en) .figure figcaption::after { content: "scroll \2192"; }
}

/* ---------- sections ---------- */

.section { padding: 72px 0 8px; }

.section-head { margin-bottom: 36px; max-width: 760px; }

.section-index {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.section-index::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--mint);
  transform: rotate(45deg);
}
.section-index::after {
  content: "";
  flex: 1;
  max-width: 120px;
  border-top: 2px dashed var(--line-strong);
}

.section h2 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.section-sub {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 64ch;
}

/* alternating band for visual rhythm */
.section-band {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 64px;
  padding-top: 72px;
  padding-bottom: 72px;
}
.section-band + .section { padding-top: 72px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 18px;
  box-shadow: var(--shadow-card);
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.card p { font-size: 15.5px; color: var(--ink-2); margin-bottom: 8px; }

.card-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  margin-bottom: 14px;
}
.tag-mint  { background: var(--mint-soft);  color: var(--mint-deep); }
.tag-amber { background: var(--amber-soft); color: var(--amber-deep); }
.tag-red   { background: var(--red-soft);   color: var(--red-deep); }
.tag-blue  { background: var(--blue-soft);  color: var(--blue-deep); }
.tag-gray  { background: var(--bg);         color: var(--ink-3); border: 1px solid var(--line); }

/* ---------- problem section ---------- */

.problem-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-bottom: 28px;
}

.problem-card { border-top: 4px solid var(--line-strong); }
.problem-card .card-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.problem-card--bad { border-top-color: var(--red); }
.problem-card--bad .card-label { color: var(--red-deep); }
.problem-card--good {
  border-top-color: var(--mint);
  background: linear-gradient(180deg, var(--mint-soft), var(--surface) 55%);
}
.problem-card--good .card-label { color: var(--mint-deep); }

.problem-note {
  border-left: 4px solid var(--amber);
  background: var(--amber-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  font-size: 16px;
  color: var(--ink-2);
  max-width: 860px;
}
.problem-note strong { color: var(--ink); }

/* ---------- how it works: timeline ---------- */

.steps {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 0;
}

.step {
  position: relative;
  padding: 0 0 30px 56px;
}
/* dashed connector — the "offline boundary" motif */
.step::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 38px;
  bottom: 0;
  border-left: 2px dashed var(--line-strong);
}
.step:last-child::before { display: none; }

.step-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  transform: rotate(45deg);
  background: var(--surface);
  border: 2px solid var(--mint);
}
.step-num span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-45deg);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--mint-deep);
}

.step h3 { font-size: 19px; margin-bottom: 6px; }
.step p { font-size: 16px; max-width: 70ch; margin-bottom: 0; }

/* ---------- features grid ---------- */

.features-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

/* ---------- scenarios ---------- */

.scenarios-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}

.scenario { display: flex; flex-direction: column; }
.scenario .figure { margin-top: auto; }
.scenario .figure { margin-top: 18px; }

/* ---------- comparison table ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.compare {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 15.5px;
}
.compare caption {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.compare th, .compare td {
  text-align: left;
  vertical-align: top;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.compare tbody tr:last-child th,
.compare tbody tr:last-child td { border-bottom: none; }

.compare thead th {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--bg);
  border-bottom: 2px solid var(--line-strong);
}
.compare thead th.col-tessera {
  color: var(--mint-deep);
  background: var(--mint-soft);
}
.compare tbody th {
  font-weight: 600;
  color: var(--ink);
  width: 26%;
}
.compare td.col-them { color: var(--ink-2); width: 35%; }
.compare td.col-tessera {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(227, 246, 241, 0.55), rgba(227, 246, 241, 0.15));
  border-left: 3px solid var(--mint);
  font-weight: 500;
}

/* ---------- resilience ---------- */

.resilience-claim {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  color: var(--ink);
  max-width: 30ch;
  line-height: 1.3;
}
.resilience-claim .mint { color: var(--mint); }

/* ---------- open core ---------- */

.opencore-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-bottom: 24px;
}

.opencore-col { padding-bottom: 24px; }
.opencore-col h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 19px;
}
.opencore-col .lic {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.opencore-col--open { border-top: 4px solid var(--mint); }
.opencore-col--commercial { border-top: 4px solid var(--amber); }

.opencore-col ul {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.opencore-col li {
  position: relative;
  padding: 9px 0 9px 26px;
  border-bottom: 1px dashed var(--line);
  font-size: 15.5px;
}
.opencore-col li:last-child { border-bottom: none; }
.opencore-col li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  transform: rotate(45deg);
}
.opencore-col--open li::before { background: var(--mint); }
.opencore-col--commercial li::before { background: var(--amber); }

/* roadmap badge: muted, dashed — designed but not shipped yet */
.badge-roadmap {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge-roadmap + .badge-roadmap { margin-left: 4px; }
.opencore-col li:has(.badge-roadmap)::before { opacity: 0.45; }

.opencore-principle {
  border-left: 4px solid var(--mint);
  background: var(--mint-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  font-size: 16px;
  color: var(--ink);
  max-width: 860px;
}

/* ---------- final CTA ---------- */

.final-cta {
  margin-top: 80px;
  background: var(--ink);
  /* inverse tessellation texture */
  background-image:
    linear-gradient(to right, rgba(246, 248, 251, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(246, 248, 251, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  color: #C8D2E0;
  padding: 80px 0;
  text-align: center;
}
.final-cta .tile { width: 18px; height: 18px; margin-bottom: 26px; }
.final-cta h2 {
  color: #FFFFFF;
  font-size: clamp(28px, 4.4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
}
.final-cta p {
  max-width: 56ch;
  margin: 0 auto 32px;
  font-size: 17px;
  color: #A8B5C7;
}
.final-cta .cta-row { justify-content: center; margin-bottom: 0; }
.final-cta .btn-secondary {
  background: transparent;
  color: #E8EDF4;
  border-color: #4A586C;
}
.final-cta .btn-secondary:hover { border-color: #E8EDF4; color: #FFFFFF; }

/* ---------- footer ---------- */

.site-footer {
  background: var(--ink);
  border-top: 1px solid #2A3648;
  padding: 26px 0 34px;
  color: #8C99AB;
  font-size: 14.5px;
}
.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}
.site-footer a { color: #C8D2E0; }
.site-footer a:hover { color: #FFFFFF; }
.site-footer .muted { color: #66758C; }
.footer-spacer { flex: 1; }
.site-footer .lang-switch { border-color: #3A4760; }
.site-footer .lang-switch a { color: #A8B5C7; }
.site-footer .lang-switch a:hover { background: #2A3648; color: #FFFFFF; }
.site-footer .lang-switch span[aria-current="true"] { background: #F6F8FB; color: var(--ink); }

/* ---------- language redirect page ---------- */

.lang-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.lang-gate .tile { width: 20px; height: 20px; margin: 0 auto 28px; }
.lang-gate h1 { font-size: 30px; margin-bottom: 8px; }
.lang-gate p { color: var(--ink-3); margin-bottom: 28px; }
.lang-gate .cta-row { justify-content: center; }

/* ============================================================
   Responsive: mobile-first, breakpoints ~720 / ~1080
   ============================================================ */

@media (min-width: 720px) {
  .problem-grid { grid-template-columns: repeat(3, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .scenarios-grid { grid-template-columns: repeat(2, 1fr); }
  .opencore-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 72px; }
  .steps { gap: 0; }
}

@media (min-width: 1080px) {
  .features-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding-top: 88px; }
  .section { padding-top: 88px; }
  .section-band { padding-top: 88px; padding-bottom: 88px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- print ---------- */

@media print {
  .site-header, .final-cta .cta-row, .cta-row { display: none; }
  body { background: #FFFFFF; }
}
