/*
 * Kurumca design system: tokens, type, controls. Shared by the marketing site, portal and admin.
 *
 * Rules this file enforces (kept here so pages cannot drift):
 *  - Color: cool neutrals with a faint blue cast + ONE accent, the brand blue of the product icon.
 *    green / amber / red exist only as status colors. No pure #000 / #fff.
 *  - Shape: one scale. Controls 10px, panels 16px, large media 22px, status pills fully round.
 *  - Motion: transform and opacity only, and only inside prefers-reduced-motion: no-preference.
 *  - Themes: light and dark from the same tokens; `data-theme` on <html> overrides the OS setting.
 */

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --bg: #f5f6f8;
  --bg-sunk: #eceef2;
  --surface: #fbfbfc;
  --surface-2: #f0f2f5;
  --raised: #fdfdfe;
  --ink: #0f1319;
  --ink-2: #454e5c;
  --ink-3: #5f6978;
  --line: #e2e5ea;
  --line-strong: #cbd0d8;
  --ctl-border: #848d9b;

  --accent: #1668c4;
  --accent-hover: #1259ab;
  --accent-ink: #fdfdfe;
  --accent-text: #0f56a8;
  --accent-soft: #e6effb;
  --accent-line: #b9d2f3;
  --focus: #1668c4;

  --ok: #14693f;      --ok-soft: #e3f3e9;
  --warn: #7c4a00;    --warn-soft: #fcefd5;
  --bad: #a8261b;     --bad-soft: #fbe7e4;

  --band-from: #0f3f8a;
  --band-to: #1668c4;
  --band-ink: #fdfdfe;

  --shadow-sm: 0 1px 2px rgb(16 28 48 / .06), 0 1px 1px rgb(16 28 48 / .04);
  --shadow-md: 0 10px 28px -10px rgb(16 28 48 / .16), 0 2px 6px rgb(16 28 48 / .05);
  --shadow-lg: 0 40px 70px -28px rgb(16 40 80 / .34), 0 14px 28px -14px rgb(16 40 80 / .14);
  --glass-edge: inset 0 1px 0 rgb(255 255 255 / .7);
  --img-filter: none;
  --art-bezel: #181d25;

  --r-ctl: 10px;
  --r-panel: 16px;
  --r-media: 22px;
  --r-pill: 999px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --z-sticky: 20;
  --z-drawer: 30;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e13;
    --bg-sunk: #080a0e;
    --surface: #11151b;
    --surface-2: #181d25;
    --raised: #1f2631;
    --ink: #e8ebf1;
    --ink-2: #aab3c1;
    --ink-3: #8f9aab;
    --line: #232a34;
    --line-strong: #323b48;
    --ctl-border: #6b7586;

    --accent: #4f95f0;
    --accent-hover: #6aa6f5;
    --accent-ink: #06101f;
    --accent-text: #7db3ff;
    --accent-soft: #14233a;
    --accent-line: #234872;
    --focus: #7db3ff;

    --ok: #6fd09a;   --ok-soft: #11291b;
    --warn: #f0bd62; --warn-soft: #2e2410;
    --bad: #ff9b92;  --bad-soft: #3a1a17;

    --band-from: #0f2c58;
    --band-to: #1b4f94;
    --band-ink: #eef4fc;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 12px 30px -10px rgb(0 0 0 / .6), 0 2px 6px rgb(0 0 0 / .3);
    --shadow-lg: 0 40px 70px -28px rgb(0 0 0 / .8), 0 14px 28px -14px rgb(0 0 0 / .5);
    --glass-edge: inset 0 1px 0 rgb(255 255 255 / .06);
    --img-filter: brightness(.9) contrast(1.03);
    --art-bezel: #2c3541;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e13; --bg-sunk: #080a0e; --surface: #11151b; --surface-2: #181d25; --raised: #1f2631;
  --ink: #e8ebf1; --ink-2: #aab3c1; --ink-3: #8f9aab; --line: #232a34; --line-strong: #323b48; --ctl-border: #6b7586;
  --accent: #4f95f0; --accent-hover: #6aa6f5; --accent-ink: #06101f; --accent-text: #7db3ff; --accent-soft: #14233a;
  --accent-line: #234872; --focus: #7db3ff;
  --ok: #6fd09a; --ok-soft: #11291b; --warn: #f0bd62; --warn-soft: #2e2410; --bad: #ff9b92; --bad-soft: #3a1a17;
  --band-from: #0f2c58; --band-to: #1b4f94; --band-ink: #eef4fc;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 12px 30px -10px rgb(0 0 0 / .6), 0 2px 6px rgb(0 0 0 / .3);
  --shadow-lg: 0 40px 70px -28px rgb(0 0 0 / .8), 0 14px 28px -14px rgb(0 0 0 / .5);
  --glass-edge: inset 0 1px 0 rgb(255 255 255 / .06);
  --img-filter: brightness(.9) contrast(1.03);
  --art-bezel: #2c3541;
}

/* ── Reset and type ─────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  /* Safety net: a stray wide element must never produce sideways scrolling on a phone. `clip` (not
     `hidden`) keeps position: sticky working. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.62 var(--font);
  font-feature-settings: "kern", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.03em; line-height: 1.12; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-text); text-underline-offset: .2em; }
a, button, summary, label, select { -webkit-tap-highlight-color: transparent; }
/* No 300 ms double-tap-zoom delay on controls. */
a, button, summary, input, select, textarea, label { touch-action: manipulation; }
img, svg, video { max-width: 100%; }
img { height: auto; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, samp { font-family: var(--mono); font-size: .92em; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
/* Headings are focused by script (to announce a result); they are not controls, so no ring. */
:is(h1, h2, h3)[tabindex="-1"]:focus { outline: none; }

.wrap { width: min(76rem, 100% - 2rem); margin-inline: auto; }
.wrap-narrow { width: min(46rem, 100% - 2rem); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.link-arrow { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .9rem; text-decoration: none; color: var(--accent-text); white-space: nowrap; }
.link-arrow:hover { text-decoration: underline; }
.ic-arrow { transition: transform .25s var(--ease); }
.link-arrow:hover .ic-arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: no-preference) {
  .spin { animation: spin 1s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}
.fine { margin-top: 1rem; font-size: .8125rem; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.skip {
  position: fixed; top: .75rem; left: .75rem; z-index: calc(var(--z-toast) + 1);
  padding: .6rem 1rem; border-radius: var(--r-ctl); background: var(--ink); color: var(--bg); font-weight: 500;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Inline icon (Phosphor sprite). Size follows the surrounding text. */
.ic { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; vertical-align: -.25em; }
.ic-sm { width: 1em; height: 1em; }
.ic-lg { width: 1.5em; height: 1.5em; }

/* ── Buttons ────────────────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;
  min-height: 2.75rem; padding: 0 1.25rem; border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 .9375rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--ctl-border); background: var(--raised); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), 0 1px 2px rgb(10 50 120 / .3);
}
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-danger.solid { background: var(--bad); color: var(--bg); border-color: transparent; }
.btn-danger.solid:hover { filter: brightness(1.08); }
.btn-lg { min-height: 3.25rem; padding: 0 1.6rem; font-size: 1rem; }
.btn-sm { min-height: 2.25rem; padding: 0 .85rem; font-size: .8125rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn .ic { transition: transform .25s var(--ease); }
a.btn:hover .ic-arrow { transform: translateX(3px); }

/* ── Forms ──────────────────────────────────────────────────────────────────────────────────── */

.field { display: grid; gap: .5rem; margin-bottom: 1rem; }
.field > label, .field > .label { font-size: .875rem; font-weight: 500; color: var(--ink); }
.field .hint { font-size: .8125rem; color: var(--ink-3); }
.field .error { font-size: .8125rem; color: var(--bad); font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
@media (max-width: 36rem) { .field-row { grid-template-columns: minmax(0, 1fr); } }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 2.75rem; padding: .625rem .875rem; border-radius: var(--r-ctl);
  border: 1px solid var(--ctl-border); background: var(--raised); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus);
}
[aria-invalid="true"] { border-color: var(--bad) !important; }
input[type="checkbox"], input[type="radio"] { width: 1.125rem; height: 1.125rem; accent-color: var(--accent); margin: 0; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
.check { display: flex; gap: .625rem; align-items: center; font-size: .9rem; cursor: pointer; }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 2.5rem; cursor: pointer; }
.select > .ic { position: absolute; right: .875rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-3); }
fieldset { border: 1px solid var(--line-strong); border-radius: var(--r-panel); padding: 1rem 1.25rem 1.1rem; margin: 0 0 1rem; }
legend { padding: 0 .5rem; font-size: .875rem; font-weight: 500; }

/* Segmented control built on real radio inputs (keyboard and screen readers work natively). */
.seg { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.1rem; border-radius: calc(var(--r-ctl) - 3px);
  font-size: .9375rem; font-weight: 500; color: var(--ink-2); transition: background-color .2s, color .2s, box-shadow .2s;
}
.seg label:has(:checked) span { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg label:has(:focus-visible) span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Status: badge, notice, chip ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: .375rem; padding: .2rem .65rem; border-radius: var(--r-pill);
  font: 500 .75rem/1.35 var(--font); background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge .ic { width: .95em; height: .95em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }

.notice {
  display: flex; gap: .625rem; align-items: flex-start; padding: .75rem .9rem; border-radius: var(--r-ctl);
  font-size: .875rem; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
}
.notice .ic { margin-top: .1rem; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.notice.err { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.notice.info { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-text); font-size: .8125rem; font-weight: 500;
}
.chip.off { background: var(--surface-2); color: var(--ink-3); text-decoration: line-through; }

/* ── Skeleton, dialog, toast ────────────────────────────────────────────────────────────────── */

.skeleton {
  display: block; height: 1rem; border-radius: 8px; background: var(--surface-2);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 85%, var(--ink) 15%) 50%, var(--surface-2) 100%);
    background-size: 220% 100%; animation: shimmer 1.6s ease-in-out infinite;
  }
  @keyframes shimmer { to { background-position: -220% 0; } }
}

dialog.modal {
  width: min(36rem, 100% - 2rem); max-height: min(90dvh, 48rem); padding: 0; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgb(7 10 16 / .55); }
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open] { animation: dialog-in .28s var(--ease); }
  dialog.modal[open]::backdrop { animation: fade-in .28s ease; }
  @keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
  @keyframes fade-in { from { opacity: 0; } }
}
.modal-form { display: contents; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.0625rem; letter-spacing: -.02em; }
.modal-body { padding: 1.25rem; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .625rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); background: var(--bg); }

.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: var(--z-toast); display: grid; gap: .5rem; width: min(24rem, 100% - 2rem); pointer-events: none; }
.toast {
  display: flex; gap: .625rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-ctl);
  background: var(--ink); color: var(--bg); font-size: .875rem; box-shadow: var(--shadow-md); pointer-events: auto;
}
.toast.err { background: var(--bad); color: var(--bg); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .35s var(--ease); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
}

/* ── Scroll reveal (only when JS has marked the page) ───────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0; transform: translateY(16px);
    transition: opacity .8s var(--ease), transform .8s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js .reveal.in { opacity: 1; transform: none; }
}

@media (forced-colors: active) {
  .btn, input, select, textarea { border: 1px solid ButtonText; }
  .badge, .chip { border: 1px solid CanvasText; }
}
