/* =========================================================================
   ICF — icformat.org
   Minimalist, modern design system. Dark-first with a light toggle.
   ========================================================================= */

:root {
  --bg:        #0a0d12;
  --bg-soft:   #0f141b;
  --panel:     #11171f;
  --panel-2:   #161d27;
  --border:    #222c38;
  --border-2:  #2c3848;
  --text:      #e6edf3;
  --text-soft: #aeb9c6;
  --muted:     #7c8a9a;
  --accent:    #34d399;   /* emerald 400 */
  --accent-2:  #22d3ee;   /* cyan 400    */
  --accent-3:  #818cf8;   /* indigo 400  */
  --danger:    #f87171;
  --warn:      #fbbf24;
  --ok:        #34d399;

  --radius:    14px;
  --radius-sm: 9px;
  --maxw:      1120px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.55);
  --grad: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
}

[data-theme="light"] {
  --bg:        #ffffff;
  --bg-soft:   #f7f9fb;
  --panel:     #ffffff;
  --panel-2:   #f4f7fa;
  --border:    #e4e9f0;
  --border-2:  #d4dbe5;
  --text:      #0b1220;
  --text-soft: #38465a;
  --muted:     #64748b;
  --accent:    #0ea472;
  --accent-2:  #0891b2;
  --accent-3:  #4f46e5;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 16px 40px -20px rgba(16,24,40,.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 92px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ambient gradient glow behind the page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 75% -10%, color-mix(in oklab, var(--accent-2) 14%, transparent), transparent 60%),
    radial-gradient(50rem 35rem at 10% 0%, color-mix(in oklab, var(--accent-3) 12%, transparent), transparent 55%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

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

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.6) blur(14px);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 22px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.brand .logo { width: 30px; height: 30px; display: block; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 12px; border-radius: 8px; font-size: 14.5px; color: var(--text-soft);
  font-weight: 500; transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: var(--panel-2); }
.nav-links a.active { color: var(--text); background: color-mix(in oklab, var(--accent) 14%, transparent); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px !important; border: 1px solid var(--border-2); border-radius: 8px;
}
.nav-cta:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--border-2)); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel);
  color: var(--text-soft); cursor: pointer; transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-links {
    position: fixed; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: 2px; padding: 14px 24px 22px; background: var(--bg-soft);
    border-bottom: 1px solid var(--border); margin: 0;
    transform: translateY(-130%); transition: transform .25s ease; box-shadow: var(--shadow);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 14px; font-size: 16px; }
  .nav-toggle { display: inline-grid; margin-left: auto; }
}

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

.btn {
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; cursor: pointer; transition: .16s; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); color: #04140e; box-shadow: 0 8px 24px -10px color-mix(in oklab, var(--accent) 70%, transparent); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { border-color: color-mix(in oklab, var(--accent) 45%, var(--border-2)); background: var(--panel-2); }
.btn-sm { padding: 8px 13px; font-size: 13.5px; }

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

.hero { padding: 92px 0 64px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--accent);
  padding: 6px 12px; border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--border));
  border-radius: 999px; background: color-mix(in oklab, var(--accent) 8%, transparent);
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.1rem); line-height: 1.04; letter-spacing: -.035em;
  margin: 26px auto 0; max-width: 16ch; font-weight: 800;
}
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--text-soft); max-width: 60ch; margin: 22px auto 0; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }
.hero-meta { margin-top: 30px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.hero-meta b { color: var(--text); font-weight: 600; }

/* ---------- section scaffolding ---------------------------------------- */

section { padding: 56px 0; }
.section-head { max-width: 60ch; margin-bottom: 38px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); letter-spacing: -.025em; margin: 0 0 12px; font-weight: 750; }
.section-head p { color: var(--text-soft); font-size: 1.05rem; margin: 0; }
.kicker { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }

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

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: border-color .18s, transform .18s; position: relative;
}
.card:hover { border-color: var(--border-2); }
.card .ic {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 24%, var(--border));
  color: var(--accent); margin-bottom: 16px;
}
.card .ic svg { width: 21px; height: 21px; }
.card h3 { margin: 0 0 8px; font-size: 1.12rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-soft); font-size: .96rem; }
.card.link-card::after {
  content: "→"; position: absolute; top: 22px; right: 22px; color: var(--muted);
  transition: .18s; opacity: 0;
}
.card.link-card:hover::after { opacity: 1; transform: translateX(3px); color: var(--accent); }

/* ---------- code block / sample ---------------------------------------- */

.code {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel);
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
}
.code-head .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-2); }
.code-head .name { margin-left: 6px; }
.code-head .copy { margin-left: auto; cursor: pointer; color: var(--muted); border: 0; background: none; font-size: 12.5px; font-family: var(--sans); }
.code-head .copy:hover { color: var(--accent); }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 13.2px; line-height: 1.7; }
.code code { font-family: var(--mono); }

/* ICF syntax tint (very light, applied by JS) */
.tok-dir { color: var(--accent-2); }
.tok-key { color: var(--accent-3); }
.tok-mark { color: var(--accent); }
.tok-com { color: var(--muted); font-style: italic; }

/* ---------- comparison / advantages ------------------------------------ */

.adv { display: flex; gap: 14px; align-items: flex-start; padding: 4px 0; }
.adv .tick {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); margin-top: 2px;
}
.adv h4 { margin: 0 0 3px; font-size: 1rem; }
.adv p { margin: 0; color: var(--text-soft); font-size: .94rem; }

/* ---------- spec / docs layout ----------------------------------------- */

.docs { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; align-items: start; padding-top: 36px; }
.toc { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; }
.toc .toc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: 5px 12px; border-left: 2px solid var(--border); color: var(--muted);
  font-size: 13.3px; transition: .14s; border-radius: 0 6px 6px 0;
}
.toc li a:hover { color: var(--text); border-left-color: var(--border-2); }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, transparent); }
.toc li.lvl-2 a { padding-left: 24px; font-size: 12.7px; }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } .toc { display: none; } }

.prose { max-width: 80ch; }
.prose h1 { font-size: 2rem; letter-spacing: -.025em; margin: 2.4rem 0 1rem; padding-top: .4rem; font-weight: 750; }
.prose h1:first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; letter-spacing: -.02em; margin: 2.2rem 0 .9rem; font-weight: 700; }
.prose h3 { font-size: 1.18rem; margin: 1.8rem 0 .7rem; font-weight: 650; }
.prose h4 { font-size: 1rem; margin: 1.4rem 0 .5rem; color: var(--text-soft); }
.prose p { margin: .85rem 0; color: var(--text-soft); }
.prose strong { color: var(--text); font-weight: 650; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.prose ul, .prose ol { color: var(--text-soft); padding-left: 1.4rem; margin: .8rem 0; }
.prose li { margin: .3rem 0; }
.prose li::marker { color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem 0; }
.prose code {
  font-family: var(--mono); font-size: .88em; background: var(--panel-2);
  border: 1px solid var(--border); padding: .12em .42em; border-radius: 6px; color: var(--accent-2);
}
.prose pre {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.65; box-shadow: var(--shadow);
}
.prose pre code { background: none; border: 0; padding: 0; color: var(--text); font-size: 13px; }
.prose table {
  width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .92rem;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.prose th { background: var(--panel); font-weight: 600; color: var(--text); }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { color: var(--accent); }

.doc-hero { padding: 44px 0 8px; border-bottom: 1px solid var(--border); }
.doc-hero .badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text-soft);
}
.badge .d { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- downloads --------------------------------------------------- */

.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .dl-grid { grid-template-columns: 1fr; } }
.dl-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.dl-card .head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.dl-card .head .logo { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); }
.dl-card .head .logo svg { width: 26px; height: 26px; }
.dl-card h3 { margin: 0; font-size: 1.25rem; }
.dl-card .sub { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.dl-card .meta { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0 18px; font-size: 13px; color: var(--text-soft); }
.dl-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.dl-card .meta b { color: var(--text); }

.tabs { display: flex; gap: 4px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 7px 10px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; border-radius: 7px; cursor: pointer; font-family: var(--mono); }
.tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- validator --------------------------------------------------- */

.validator { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 880px) { .validator { grid-template-columns: 1fr; } }
.editor-wrap { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
.editor-bar .name { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.editor-bar .spacer { flex: 1; }
.editor-bar select { background: var(--panel-2); color: var(--text-soft); border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; font-family: var(--mono); }
#icf-input {
  width: 100%; min-height: 460px; border: 0; resize: vertical; outline: none;
  background: transparent; color: var(--text); font-family: var(--mono); font-size: 13.2px;
  line-height: 1.7; padding: 16px 18px; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
.result-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; overflow: hidden; min-height: 200px; }
.result-summary { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.result-summary .status { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; }
.result-summary .status .dot { width: 11px; height: 11px; border-radius: 50%; }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in oklab, var(--ok) 22%, transparent); }
.status.err .dot { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 22%, transparent); }
.status.idle .dot { background: var(--muted); }
.result-counts { margin-left: auto; display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-soft); }
.pill.err { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--border)); }
.pill.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 40%, var(--border)); }
.messages { list-style: none; margin: 0; padding: 8px; max-height: 420px; overflow-y: auto; }
.messages li { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; align-items: start; padding: 11px 12px; border-radius: 9px; }
.messages li + li { margin-top: 2px; }
.messages li:hover { background: var(--panel-2); }
.msg-sev { font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.msg-sev.ERROR { color: var(--danger); background: color-mix(in oklab, var(--danger) 14%, transparent); }
.msg-sev.WARNING { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); }
.msg-line { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.msg-body { font-size: 13.6px; }
.msg-body .code { display: inline; background: none; border: 0; padding: 0; box-shadow: none; font-family: var(--mono); font-size: 12px; color: var(--accent-2); margin-right: 6px; }
.empty-hint { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.validator-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- callouts ---------------------------------------------------- */

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 6%, var(--panel)); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 22px 0; font-size: .95rem; color: var(--text-soft);
}
.callout b { color: var(--text); }

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

.site-footer { border-top: 1px solid var(--border); padding: 52px 0 40px; margin-top: 40px; background: var(--bg-soft); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.footer-grid h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.footer-grid a { display: block; color: var(--text-soft); font-size: 14px; padding: 4px 0; transition: color .14s; }
.footer-grid a:hover { color: var(--accent); }
.footer-about p { color: var(--text-soft); font-size: 14px; max-width: 36ch; margin: 12px 0 0; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.footer-bottom a { color: var(--text-soft); }
.footer-bottom a:hover { color: var(--accent); }

/* ---------- misc -------------------------------------------------------- */

.mono { font-family: var(--mono); }
.center { text-align: center; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
::selection { background: color-mix(in oklab, var(--accent) 40%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* thin scrollbars in dark UI */
.toc::-webkit-scrollbar, .messages::-webkit-scrollbar, .code pre::-webkit-scrollbar, #icf-input::-webkit-scrollbar { width: 9px; height: 9px; }
.toc::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
