/* MAGCODE shared styles: one plain, light system for every page.
   Product pages set their accent with a body class (p-gateway, p-afterformat, p-manga) and keep
   anything only they use in their own <style> block. */
:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --subtle: #fafafa;
  --sunken: #f4f4f5;
  --ink: #0a0a0a;
  --ink-2: #3f4148;
  --muted: #626875;
  --rule: #e5e7eb;
  --rule-strong: #c9ccd3;
  --control: #8b919c;
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --accent-wash: #eff4ff;
  --on-accent: #ffffff;
  --ok: #15803d;
  --ok-wash: #f0fdf4;
  --soon: #b45309;
  --soon-wash: #fffbeb;
  --fault: #b91c1c;
  --fault-wash: #fef2f2;
  --signal-wash: #f6e8cf;
  --console: #0a0a0a;
  --console-2: #161618;
  --console-rule: #2a2a2e;
  --console-ink: #ededed;
  --console-muted: #a1a1aa;
  --lamp-ok: #22c55e;
  --lamp-wait: #f59e0b;
  --lamp-fail: #ef4444;
  --mark-afterformat: #3d7fe0;
  --mark-manga: #e0485f;
  --display: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --measure: 34rem;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --wrap: 1120px;
  --radius: 14px;
  --lift: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -18px rgba(15, 23, 42, 0.28);
  color-scheme: light;
}

/* Product accents: links, badges and small highlights only. */
.p-gateway { --accent: #0b7350; --accent-ink: #065238; --accent-wash: #ecfdf3; }
.p-afterformat { --accent: #1f5bb8; --accent-ink: #174a96; --accent-wash: #eef3fc; }
.p-manga { --accent: #b0263d; --accent-ink: #8e1b2f; --accent-wash: #fdf0f2; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; scrollbar-color: var(--rule-strong) var(--paper); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--body); -webkit-font-smoothing: antialiased; }
::selection { background: #dbe6fd; color: var(--ink); }
input, textarea { caret-color: var(--accent); }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
code, kbd, pre, .mono { font-family: var(--mono); }
h1, h2, h3 { margin: 0; font-family: var(--display); color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.2rem); line-height: 1.05; font-weight: 600; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.35rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.025em; }
h3 { font-size: 1.08rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
img, svg { max-width: 100%; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
.eyebrow { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.prose { max-width: var(--measure); color: var(--ink-2); }
.tbd { background: var(--signal-wash); color: var(--ink); border-radius: 3px; padding: 0 4px; }
.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; }
.skip { position: absolute; left: -9999px; top: 12px; z-index: 20; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; }
.skip:focus { left: 16px; }

/* Header */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.crumb { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.brand svg, .product-name svg { flex: none; }
.crumb-sep { color: var(--rule-strong); font-size: 1.3rem; font-weight: 300; line-height: 1; }
.product-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.nav a:hover { background: var(--subtle); color: var(--ink); }
.nav a[aria-current="page"], .nav a[aria-current="location"] { background: var(--sunken); color: var(--ink); }
.site-head .btn { position: relative; min-height: 38px; padding: 0 14px; font-size: 0.875rem; flex: none; }
.site-head .btn::after { content: ""; position: absolute; inset: -4px 0; }
.site-head .pill { flex: none; }
.site-head { transition: transform 0.25s ease; }
.site-head.away { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { .site-head { transition: none; } }
@media (max-width: 900px) {
  html { scroll-padding-top: 128px; }
  .site-head .wrap { flex-wrap: wrap; row-gap: 0; min-height: 0; }
  .crumb { min-height: 60px; }
  .site-head .btn, .site-head .pill { margin-left: auto; }
  .nav { order: 3; flex-basis: calc(100% + 48px); margin-inline: -24px; padding-inline: 12px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--rule); }
  .nav::-webkit-scrollbar { display: none; }
  .nav { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .nav a { flex: none; min-height: 44px; }
  .nav:not(:has(a + a)) { order: 0; flex-basis: auto; margin-inline: auto 0; padding-inline: 0; border-top: 0; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 600px) {
  .crumb:has(.product-name) .wordmark { display: none; }
  .site-head .wrap { column-gap: 12px; }
  .crumb { gap: 8px; }
}
@media (max-width: 480px) {
  .nav { padding-inline: 15px; }
  .nav a { padding: 0 9px; font-size: 0.875rem; }
  .site-head .btn { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
  .product-name svg { display: none; }
}

/* Buttons and badges */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: 500 0.9375rem/1 var(--body); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2b2d33; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--control); }
.btn-ghost:hover { border-color: var(--ink); }
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--ok-wash); color: var(--ok); font-size: 0.8rem; font-weight: 500; white-space: nowrap; }
.pill.soon { background: var(--soon-wash); color: var(--soon); }

/* Hero: centred copy, the product's demonstration underneath */
.hero { padding-block: clamp(64px, 9vw, 112px) clamp(48px, 6vw, 80px); }
.hero .wrap { display: flex; flex-direction: column; align-items: center; gap: clamp(40px, 5vw, 56px); text-align: center; }
.hero-copy { display: flex; flex-direction: column; align-items: center; gap: 22px; max-width: 820px; min-width: 0; }
.hero h1 .second { display: block; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.hero .wrap > figure { width: 100%; max-width: 760px; margin: 0; text-align: left; }
@media (max-width: 600px) {
  .hero { padding-top: 40px; }
  .hero .lede { font-size: 1.05rem; }
  .hero .wrap { align-items: stretch; text-align: left; }
  .hero-copy { align-items: flex-start; }
  .hero-actions { justify-content: flex-start; }
}
@media (max-width: 480px) { .hero .hero-actions .btn { flex: 1 1 auto; padding: 0 14px; white-space: nowrap; } }

/* Window: a bordered frame for product demonstrations */
.console {
  margin: 0; min-width: 0; overflow: hidden;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--lift);
  font: 400 0.9375rem/1.5 var(--body);
}
.console-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 0.82rem; }
.console-bar .tag { color: var(--muted); }
.console-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
a.row { text-decoration: none; color: inherit; }
a.row:hover { border-color: var(--rule-strong); }
.lamp { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--rule-strong); }
.lamp.ok { background: var(--lamp-ok); }
.lamp.wait { background: var(--lamp-wait); }
.lamp.fail { background: var(--lamp-fail); }
.row .name { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.row .why { display: block; color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.code-pill { padding: 3px 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); font: 500 0.78rem/1.4 var(--mono); white-space: nowrap; }
.code-pill.ok { background: var(--ok-wash); color: var(--ok); }
.code-pill.wait { background: var(--soon-wash); color: var(--soon); }
.code-pill.fail { background: var(--fault-wash); color: var(--fault); }
.code-pill.idle { color: var(--muted); }
.console-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.82rem; }

/* Real screenshot that enlarges when selected (site.js opens the dialog) */
.hero .wrap > figure.shot-real { max-width: 100%; }
.shot-real { margin: 0; }
.zoom { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius); background: #0c1118; box-shadow: var(--lift); cursor: zoom-in; }
.zoom img { display: block; width: 100%; height: auto; transition: transform 0.3s ease; }
.zoom:hover img { transform: scale(1.01); }
.shot-real figcaption { margin-top: 10px; text-align: center; color: var(--muted); font-size: 0.875rem; }
dialog.lightbox { max-width: 96vw; max-height: 94vh; padding: 0; border: 0; border-radius: 10px; background: transparent; overflow: visible; }
dialog.lightbox::backdrop { background: rgba(10, 10, 10, 0.85); }
dialog.lightbox img { display: block; max-width: 96vw; max-height: 94vh; width: auto; height: auto; border-radius: 10px; }
.lightbox-close { position: fixed; top: 16px; right: 16px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }
@media (max-width: 900px) {
  dialog.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; border-radius: 0; overflow: auto; background: #0c1118; }
  dialog.lightbox[open] { display: flex; align-items: center; }
  dialog.lightbox img { flex: none; max-width: none; max-height: none; width: 1200px; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .zoom img { transition: none; } }

/* Sections */
section { padding-block: clamp(56px, 8vw, 88px); }
.band { background: var(--subtle); border-block: 1px solid var(--rule); }
.section-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: clamp(28px, 4vw, 40px); max-width: 680px; }
.section-head.flush { margin-bottom: 0; }
.section-head.tight { margin-bottom: 24px; }

/* Cell grids: bordered cells instead of rows of cards */
.values, .features, .isnt { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.values { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.isnt { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.value, .feature, .isnt > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 24px; background: var(--surface); }
.value p, .feature p, .isnt p { color: var(--ink-2); font-size: 0.9375rem; }
@media (max-width: 900px) { .values, .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .values, .features, .isnt { grid-template-columns: minmax(0, 1fr); } }

/* Split: the case on the left, the product showing it on the right */
.split { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.value-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.value-list li { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.value-list p { color: var(--ink-2); font-size: 0.9375rem; }
.isnt.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .isnt.three { grid-template-columns: minmax(0, 1fr); } }

/* Numbered steps of a process */
.seq { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.seq li { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 22px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.seq .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--sunken); color: var(--ink); font: 500 0.8rem/1 var(--mono); }
.seq p { color: var(--ink-2); font-size: 0.9375rem; }
.seq .detail { margin-top: auto; align-self: flex-start; padding: 6px 9px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); font: 400 0.78rem/1.4 var(--mono); overflow-wrap: anywhere; }
@media (max-width: 900px) { .seq { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .seq { grid-template-columns: minmax(0, 1fr); } }
.note { margin-top: 28px; max-width: 38rem; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--subtle); color: var(--ink-2); font-size: 0.9375rem; }
.note + .note { margin-top: 12px; }
.band .note { background: var(--surface); }
.note b { color: var(--ink); }

/* Pricing card and the steps beside it */
.licence { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .licence { grid-template-columns: minmax(0, 1fr); } }
.period { display: flex; flex-direction: column; gap: 16px; padding: 28px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--lift); }
.period .big { font-weight: 600; font-size: clamp(2.6rem, 1.8rem + 3vw, 3.6rem); line-height: 1; letter-spacing: -0.035em; color: var(--ink); font-variant-numeric: tabular-nums; }
.period .big small { margin-left: 8px; font-size: 0.9375rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.period-title { font-weight: 600; color: var(--ink); }
.period li { display: flex; gap: 10px; }
.period li::before { content: ""; flex: none; width: 5px; height: 5px; margin-top: 0.62em; border-radius: 50%; background: var(--muted); }
.period-sub { margin-top: -6px; color: var(--muted); font-size: 0.875rem; }
.period .period-act + .period-sub { margin-top: 0; }
.period ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 0.9375rem; }
.period-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.period > .tbd { align-self: flex-start; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.steps li:first-child { border-top: 1px solid var(--rule); }
.steps .i { padding-top: 3px; font: 500 0.82rem/1.4 var(--mono); color: var(--muted); }
.steps p { margin-top: 4px; color: var(--ink-2); font-size: 0.9375rem; }

/* FAQ */
.faq { max-width: 820px; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { position: relative; padding: 18px 36px 18px 0; list-style: none; cursor: pointer; font-weight: 600; font-size: 1.03rem; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 4px; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: var(--muted);
  -webkit-mask: var(--chevron) center / contain no-repeat;
  mask: var(--chevron) center / contain no-repeat;
  transition: transform 0.2s;
}
.faq summary:hover::after { background: var(--ink); }
.faq details[open] summary::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }
.faq .a { display: flex; flex-direction: column; gap: 10px; max-width: var(--measure); padding: 0 0 20px; color: var(--ink-2); }

/* Closing call to action: a dark box inside the page */
.cta { padding-block: 24px clamp(64px, 8vw, 96px); padding-inline: 24px; }
.cta .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; max-width: calc(var(--wrap) - 48px); padding: clamp(28px, 4vw, 44px); border-radius: var(--radius); background: var(--ink); color: #fff; }
.cta h2 { color: #fff; max-width: 22ch; }
.cta p { margin-top: 10px; max-width: 48ch; color: #c9ccd3; }
.cta .hero-actions { justify-content: flex-start; }
.cta .btn-primary { background: #fff; color: var(--ink); }
.cta .btn-primary:hover { background: #e5e7eb; }
.cta .btn-ghost { background: transparent; color: #fff; border-color: var(--control); }
.cta .btn-ghost:hover { border-color: #fff; }
.cta :focus-visible { outline-color: #fff; }
@media (max-width: 600px) { .cta { padding-inline: 16px; } }

/* Footer */
.site-foot { padding-block: 48px 36px; border-top: 1px solid var(--rule); font-size: 0.9375rem; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
.foot-about { display: flex; flex-direction: column; gap: 12px; }
.foot-about p { max-width: 36ch; }
.foot-h { margin-bottom: 8px; font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.foot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.foot-list a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.foot-list a:hover { color: var(--ink); text-decoration: underline; }
.foot-list li { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.foot-list .soon { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.foot-legal { display: flex; flex-direction: column; gap: 6px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); }
.foot-legal p { max-width: 32rem; line-height: 1.55; }
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-about { grid-column: 1 / -1; }
}
