/* ==========================================================================
   embednet.systems — Design System (design drop, 2026-11-24)
   Theme: پٹ «به سمت چابهار» — warm paper day / charcoal night, one evening-
   gold accent, flat, 2px corners, no shadows. Signature: احترام به خواننده.
   Tokens are the owner's approved palette (blog DESIGN-LANGUAGE.md) —
   do not re-pick colors here.
   Targets the markup emitted by build.py (classes: topbar, identity,
   primary-nav, lang-switch, theme-toggle, eyebrow, frame, featured, cards,
   card, card-*, tag, text-link, lede, contact-list, footer).
   Theme states: :root = day. Night applies via [data-theme="dark"] OR via
   prefers-color-scheme when the visitor has not chosen (no data-theme attr).
   ========================================================================== */

/* ---------- Fonts (local only) ---------- */
@font-face {
  font-family: "Vazirmatn";
  src: url("Vazirmatn-Regular.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("Vazirmatn-Bold.woff2") format("woff2");
  font-style: normal; font-weight: 600 800; font-display: swap;
}

/* ---------- Tokens: Day (warm paper) ---------- */
:root {
  color-scheme: light;
  --paper: #f2efe9;
  --paper-lift: #faf8f2;
  --surface: #eae5d9;
  --ink: rgba(0, 0, 0, 0.84);
  --ink-2: rgba(0, 0, 0, 0.64);
  --muted: rgba(0, 0, 0, 0.54);
  --line: rgba(0, 0, 0, 0.16);
  --line-soft: rgba(0, 0, 0, 0.09);
  --accent: #a87b1f;          /* decorative / large text */
  --accent-strong: #8a6517;   /* small text, links, focus — ≥4.5:1 on paper */
  --accent-soft: rgba(168, 123, 31, 0.09);
  --on-accent: #fffaf1;
  --radius: 2px;
  --ease: 0.18s ease;
  --font-fa: "Vazirmatn", Tahoma, Arial, sans-serif;
  --font-en: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

/* ---------- Tokens: Night (charcoal) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1c1f1e;
    --paper-lift: #222524;
    --surface: #242726;
    --ink: rgba(255, 255, 255, 0.88);
    --ink-2: rgba(255, 255, 255, 0.68);
    --muted: rgba(255, 255, 255, 0.57);
    --line: rgba(255, 255, 255, 0.18);
    --line-soft: rgba(255, 255, 255, 0.10);
    --accent: #e3a82b;
    --accent-strong: #f0be4a;
    --accent-soft: rgba(227, 168, 43, 0.12);
    --on-accent: #1c1f1e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c1f1e;
  --paper-lift: #222524;
  --surface: #242726;
  --ink: rgba(255, 255, 255, 0.88);
  --ink-2: rgba(255, 255, 255, 0.68);
  --muted: rgba(255, 255, 255, 0.57);
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.10);
  --accent: #e3a82b;
  --accent-strong: #f0be4a;
  --accent-soft: rgba(227, 168, 43, 0.12);
  --on-accent: #1c1f1e;
}

/* ---------- Layout & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 76rem;
  padding-inline: clamp(1.25rem, 4vw, 2.75rem);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-en);
  font-size: 1.0625rem;
  line-height: 1.65;
  transition: background-color var(--ease), color var(--ease);
}
html[lang="fa"] body { font-family: var(--font-fa); line-height: 1.95; }

main { display: block; padding-bottom: 1rem; }
::selection { background: var(--accent-soft); }

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; border-radius: var(--radius); }

/* ---------- Type ---------- */
h1 {
  font-size: clamp(2rem, 5.2vw, 3.3rem);
  line-height: 1.16; font-weight: 800; letter-spacing: 0;
  margin: 0.6rem 0 0; max-width: 17em;
}
html[lang="fa"] h1 { line-height: 1.5; }
h2 { font-size: clamp(1.3rem, 2.8vw, 1.6rem); line-height: 1.3; font-weight: 700; margin: 0 0 0.7rem; }
html[lang="fa"] h2 { line-height: 1.6; }
h3 { line-height: 1.35; margin: 0; }
html[lang="fa"] h3 { line-height: 1.6; }
p { margin: 0 0 1.1rem; }

.eyebrow {
  display: flex; align-items: center; gap: 0.7rem;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-strong);
  margin: clamp(2.6rem, 7vw, 4.6rem) 0 0;
}
html[lang="fa"] .eyebrow { letter-spacing: 0; font-size: 0.95rem; }
.eyebrow::before { content: ""; flex: none; width: 2rem; height: 2px; background: var(--accent); }

.lede { font-size: 1.16rem; color: var(--ink-2); max-width: 44rem; margin-top: 1.1rem; }
main > p { max-width: 44rem; color: var(--ink-2); }
main > h1 + p, main > .lede { color: var(--ink-2); }

/* Narrative frame (the owner's own words) — quiet, ruled, no quote marks */
.frame {
  margin: 2.2rem 0 0; padding: 0.4rem 0 0.4rem 0;
  padding-inline-start: 1.4rem;
  border-inline-start: 2px solid var(--accent);
  max-width: 44rem;
}
.frame p { font-size: 1.14rem; color: var(--ink); margin: 0 0 0.7rem; }
.frame p:last-child { margin-bottom: 0; color: var(--ink-2); }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.3rem; flex-wrap: wrap;
  min-height: 4.1rem; padding-block: 0.55rem;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.identity {
  color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.04rem;
  margin-inline-end: auto; line-height: 1.35;
}
.identity:hover { color: var(--accent-strong); }
.primary-nav { display: flex; gap: 1.45rem; align-items: center; flex-wrap: wrap; }
.primary-nav a {
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.98rem;
  padding-block: 0.3rem; border-bottom: 2px solid transparent;
}
.primary-nav a:hover { color: var(--ink); }
.primary-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.lang-switch { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.94rem; }
.lang-switch:hover { color: var(--accent-strong); }
.theme-toggle {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.32rem 0.8rem;
  transition: border-color var(--ease), color var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- Home sections ---------- */
section { padding-block: clamp(2.2rem, 5.5vw, 3.6rem); border-top: 1px solid var(--line-soft); margin-top: clamp(2.2rem, 5.5vw, 3.6rem); }
section p { max-width: 44rem; color: var(--ink-2); }

.featured {
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.4rem);
}
.featured h2 { font-size: clamp(1.45rem, 3.4vw, 1.9rem); }
.featured-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin: 1.2rem 0 0; }
.featured-links a { font-weight: 700; text-decoration: none; }
.featured-links a:hover { text-decoration: underline; }

.text-link { font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ---------- Project cards ---------- */
.cards {
  display: grid; gap: 1.1rem; margin-top: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr));
}
.cards-full { grid-template-columns: 1fr; max-width: 62rem; }
@media (min-width: 60rem) {
  .cards-full { grid-template-columns: 1fr 1fr; max-width: none; align-items: start; }
}

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 0.65rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; padding: 1.55rem 1.55rem 1.35rem;
  transition: border-color var(--ease), background-color var(--ease);
}
.card::before {
  content: ""; position: absolute; top: -1px; inset-inline: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--ease);
}
html[dir="rtl"] .card::before { transform-origin: right; }
.card:hover { border-color: var(--accent); background: var(--paper-lift); }
.card:hover::before { transform: scaleX(1); }
.card h3 { font-size: 1.2rem; font-weight: 700; }
.cards-full .card h3 { font-size: 1.32rem; }
.card p { margin: 0; }
.card-tagline { color: var(--ink-2); font-weight: 600; }
.card-desc { color: var(--ink-2); font-size: 0.99rem; }

.card-points { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.card-points li { position: relative; padding-inline-start: 1.15rem; font-size: 0.96rem; color: var(--ink-2); }
.card-points li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0.7em;
  width: 0.55rem; height: 2px; background: var(--accent);
}
html[lang="fa"] .card-points li::before { top: 0.85em; }

.card-note {
  border-inline-start: 2px solid var(--accent); background: var(--accent-soft);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  font-size: 0.93rem; color: var(--ink-2);
}

/* Status is the receipt — it carries the "real, running system" signal */
.card-status {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-size: 0.88rem; color: var(--muted); margin-top: auto; padding-top: 0.55rem;
}
.card-status::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); transform: translateY(-1px);
}
.card-status span { font-weight: 700; color: var(--ink-2); }

.card-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-family: var(--font-mono); font-size: 0.76rem; direction: ltr;
  color: var(--ink-2); background: var(--surface);
  border-radius: var(--radius); padding: 0.16rem 0.55rem;
}
.card-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.35rem; border-top: 1px solid var(--line-soft); padding-top: 0.9rem; }
.card-link { font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ---------- About page prose ---------- */
main > h1 { margin-top: clamp(2.4rem, 6vw, 4rem); }
main > h1 ~ p { max-width: 44rem; color: var(--ink-2); font-size: 1.05rem; }

/* ---------- Contact ---------- */
.contact-list { list-style: none; padding: 0; margin: 1.8rem 0 0; max-width: 44rem; }
.contact-list li {
  border-top: 1px solid var(--line-soft); padding-block: 0.95rem;
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; font-weight: 600;
}
.contact-list li:last-child { border-bottom: 1px solid var(--line-soft); }
.contact-list a { font-weight: 700; }
.contact-list a[href^="mailto:"] { direction: ltr; unicode-bidi: embed; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--line-soft); margin-top: 3rem;
  padding-block: 1.5rem 2.4rem;
  display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; align-items: baseline;
  font-size: 0.92rem; color: var(--muted);
}
footer nav { display: flex; gap: 1.3rem; flex-wrap: wrap; margin-inline-start: auto; }
footer a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
footer a:hover { color: var(--accent-strong); }

/* ---------- Responsive ---------- */
@media (max-width: 44rem) {
  .topbar { gap: 0.65rem 1.05rem; padding-block: 0.7rem; }
  .identity { margin-inline-end: 0; }
  .primary-nav { order: 3; width: 100%; gap: 1.15rem; }
  .lang-switch { margin-inline-start: auto; }
  .card { padding: 1.25rem; }
  .frame { padding-inline-start: 1rem; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
