/* Tijarat theme — Dolat's token system, Tijarat's emerald identity.

   One DOM, two skins. `html[data-theme]` selects glass or flat, the same
   contract Dolat uses, so the two products share a design language and a
   toggle cannot leave half of either on the old look.

   The variable NAMES are Tijarat's (--bg, --panel, --ink, --acc) because the
   existing 425-line stylesheet and 1735-line app.js already read them. Only
   the values changed. Renaming them would be a rewrite with no user benefit.

   Glass is the default. Flat is the fallback for low-end hardware, where a
   backdrop blur costs more than it returns.
*/

:root {
  /* ---- surfaces (Dolat's ink ramp, Tijarat's names) ---- */
  --ink-950: #070b16;
  --ink-900: #0b1020;
  --ink-850: #101731;
  --ink-800: #151d3a;

  --bg: var(--ink-950);
  --bg2: var(--ink-900);
  --panel: #121a2b;
  --panel2: #1a2338;

  /* ---- hairlines ---- */
  --line: rgba(148, 163, 184, 0.14);
  --line2: rgba(148, 163, 184, 0.22);

  /* ---- text ---- */
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --dim: #8494a8;   /* 6.11:1 on the panel; #64748b was 3.98 and failed AA */

  /* ---- accents: Tijarat keeps emerald, Dolat's mint is the same family ---- */
  --acc: #10b981;
  --acc2: #065f46;
  --mint: #34d399;
  --gold: #c8a951;
  --warn: #e4c368;
  --bad: #ef4444;

  /* Fill colours that had been hardcoded in style.css, so the primary button
     and the active tab ignored the skin. Dark ink on emerald is 7.45:1; the
     pale-on-deep pair is 4.54:1. */
  --on-accent: #04140e;
  --accent-container: #065f46;
  --on-accent-container: #8bd6b7;

  /* Green button fill. White on --acc (#10b981) is only 2.54:1, so buttons
     use a deeper green: white on #047857 is 5.48:1. */
  --acc-strong: #047857;
  --acc-strong-hover: #065f46;
  --on-acc-strong: #ffffff;

  /* ---- radii, from Dolat ---- */
  --r: 0.25rem;
  --r-lg: 0.5rem;
  --r-xl: 0.75rem;
  --radius-card: 1.25rem;
  --radius-pane: 1.75rem;

  /* ---- type ---- */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --head: "Outfit", "Hanken Grotesk", -apple-system, sans-serif;

  /* ---- per-skin, overridden below ---- */
  --surface: var(--ink-900);
  --surface-2: var(--ink-850);
  --surface-border: var(--line);
  --nav-bg: rgba(11, 16, 32, 0.92);
  --header-bg: rgba(7, 11, 22, 0.72);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sheen: none;
  --blur: none;
}

/* ------------------------------------------------------------------ glass */

/* Anchors. style.css sets this too, but the landing page loads only
   theme.css, so without it links fell back to the browser default blue. */
a {
  color: var(--acc);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Paint the canvas.
   theme.css is the only stylesheet the landing page loads, and it defines --bg
   but never applied it -- so the page rendered white with dark text on the
   hero only. Painting here means every page that loads the theme gets a
   background, whether or not it also loads style.css. */
html,
body {
  background: var(--bg);
  color: var(--ink);
}

html[data-theme='glass'] {
  --bg: var(--ink-950);
  --bg2: var(--ink-900);
  --panel: linear-gradient(160deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 100%);
  --panel2: linear-gradient(160deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
  --surface: linear-gradient(160deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 100%);
  --surface-2: linear-gradient(160deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
  --surface-border: rgba(255, 255, 255, 0.14);
  --nav-bg: rgba(255, 255, 255, 0.06);
  --header-bg: rgba(7, 11, 22, 0.60);

  --shadow-card: 0 8px 30px rgba(2, 6, 23, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 42%);
  --blur: blur(22px) saturate(160%);
}

/* ------------------------------------------------------------------- flat */

html[data-theme='flat'] {
  --bg: var(--ink-950);
  --bg2: var(--ink-900);
  --panel: var(--ink-900);
  --panel2: var(--ink-850);
  --surface: var(--ink-900);
  --surface-2: var(--ink-850);
  --surface-border: rgba(148, 163, 184, 0.16);
  --nav-bg: var(--ink-900);
  --header-bg: var(--ink-950);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5);
  --sheen: none;
  --blur: none;
}

/* ---------------------------------------------------------------- pieces */

/* Cards. The old rule was a flat var(--panel); glass needs the gradient plus
   blur, and flat needs neither. */
.panel,
.theme-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  /* Content was flush against the glass edge. */
  padding: 22px;
}

/* .panel.active is the one actually on screen; it inherits the padding above,
   but keep it explicit so a future display rule cannot drop it. */
.panel.active {
  padding: 22px;
}

/* The sheen is a highlight, not a second background: painting it as one would
   double the alpha and make glass look milky over light sections. */
.theme-sheen {
  position: relative;
  isolation: isolate;
}

.theme-sheen::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--sheen);
  pointer-events: none;
  z-index: 0;
}

.theme-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--surface-border);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.theme-nav {
  background: var(--nav-bg);
  border: 1px solid var(--surface-border);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* Inputs sit on --panel2, which is a gradient in glass. A gradient behind an
   input reads as a rendering fault, so inputs get a solid fill in both skins. */
input,
select,
textarea {
  background: var(--ink-900);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-lg);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

/* The active tab needs a fill that works on both skins. */
.tab.active {
  background: var(--surface-2);
  border-color: var(--surface-border);
  color: var(--ink);
}

/* Scrollbars: the default light bar is the one thing that still looks wrong on
   a dark glass surface. */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 4px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}