/*
  hoseinhayati.ir: one stylesheet, no framework.
  Logical properties (margin-inline-start, inset-inline-end...) make the same rules work for RTL (fa) and LTR (en).
*/

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/vazirmatn-variable.woff2") format("woff2-variations"),
       url("/fonts/vazirmatn-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #f5f7f8;
  --surface-strong: #eaeef0;
  --text: #16191d;
  --muted: #56606b;
  --border: #dfe4e8;
  --accent: #0f766e;
  --accent-strong: #0b5c56;
  --accent-soft: #e3f4f2;
  --on-accent: #ffffff;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --danger: #a3262a;
  --danger-soft: #fdecec;

  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 0.75rem;
  --container: 70rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --shadow: 0 1px 2px rgb(16 24 32 / 0.06), 0 4px 16px rgb(16 24 32 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214;
    --surface: #171b1f;
    --surface-strong: #20262b;
    --text: #e8ecef;
    --muted: #a2adb7;
    --border: #2b3238;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #11302d;
    --on-accent: #06201d;
    --warn: #f5b451;
    --warn-soft: #2e2413;
    --danger: #f28b8e;
    --danger-soft: #331819;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1214;
  --surface: #171b1f;
  --surface-strong: #20262b;
  --text: #e8ecef;
  --muted: #a2adb7;
  --border: #2b3238;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #11302d;
  --on-accent: #06201d;
  --warn: #f5b451;
  --warn-soft: #2e2413;
  --danger: #f28b8e;
  --danger-soft: #331819;
  --shadow: none;
  color-scheme: dark;
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

/* Form controls don't inherit fonts by default; without this <button> falls back to the system font. */
button, input, select, textarea { font: inherit; }

:lang(en) body,
body:lang(en) {
  line-height: 1.65;
}

h1, h2, h3 {
  line-height: 1.35;
  margin: 0 0 0.75rem;
  font-weight: 800;
  text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.1rem; font-weight: 700; }

p, ul, ol, dl, blockquote {
  margin: 0 0 1rem;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.2em;
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) a { color: var(--accent); }
}
:where(:root[data-theme="dark"]) a { color: var(--accent); }

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-strong);
  padding: 0.1em 0.35em;
  border-radius: 0.3rem;
  direction: ltr;
  unicode-bidi: isolate;
}

bdi[dir="ltr"] {
  unicode-bidi: isolate;
}

blockquote {
  margin-inline: 0;
  padding-inline-start: 1rem;
  border-inline-start: 4px solid var(--accent);
  color: var(--muted);
  font-size: 1.1rem;
}

.muted { color: var(--muted); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

/* Layout */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.narrow { max-width: 46rem; }

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-alt { background: var(--surface); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}

.section-head h2 { margin: 0; }
.section-intro { color: var(--muted); max-width: 42rem; }

.grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 48rem) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
}

.eyebrow {
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .eyebrow { color: var(--accent); }
}
:where(:root[data-theme="dark"]) .eyebrow { color: var(--accent); }

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.button-lg { min-height: 3.1rem; padding-inline: 2rem; font-size: 1rem; }

.button:hover { border-color: var(--accent); }

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
}

.brand-name { font-weight: 800; font-size: 1.05rem; }
.brand-title { color: var(--muted); font-size: 0.8rem; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a,
.nav-dropdown summary {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.nav-list a:hover,
.nav-dropdown summary:hover { background: var(--surface); }

.nav-list a[aria-current] {
  color: var(--accent-strong);
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .nav-list a[aria-current] { color: var(--accent); }
}
:where(:root[data-theme="dark"]) .nav-list a[aria-current] { color: var(--accent); }

.nav-dropdown { position: relative; }

.nav-dropdown summary {
  list-style: none;
}

.nav-dropdown summary::-webkit-details-marker { display: none; }

.nav-dropdown summary::after {
  content: "";
  display: inline-block;
  margin-inline-start: 0.4rem;
  width: 0.4rem;
  height: 0.4rem;
  border-inline-end: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.2rem) rotate(45deg);
}

.dropdown-menu {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 0.4rem);
  min-width: 14rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switch {
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
}

.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }

/* Theme toggle: needs JavaScript, so it only appears with the "js" class. On wide screens it sits after the nav. */
.theme-toggle {
  display: none;
  order: 2;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.2s;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-20deg); }
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .icon-sun { display: block; }
  :where(:root:not([data-theme="light"])) .icon-moon { display: none; }
}
:where(:root[data-theme="dark"]) .icon-sun { display: block; }
:where(:root[data-theme="dark"]) .icon-moon { display: none; }

/* Mobile navigation. Without JavaScript the menu simply stays open under the brand. */
@media (max-width: 60rem) {
  .header-inner { flex-wrap: wrap; }
  .brand { margin-inline-end: auto; }
  .theme-toggle { order: 0; }

  .js .nav-toggle { display: inline-flex; }

  .site-nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 1rem;
  }

  .js .site-nav:not(.is-open) { display: none; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: 0;
    padding-inline-start: 1rem;
  }

  .nav-actions { justify-content: space-between; }
}

/* Availability */

.availability {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.availability-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.availability-open { background: var(--accent-soft); color: var(--accent-strong); }
.availability-limited { background: var(--warn-soft); color: var(--warn); }
.availability-full { background: var(--danger-soft); color: var(--danger); }

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .availability-open { color: var(--accent); }
}
:where(:root[data-theme="dark"]) .availability-open { color: var(--accent); }

/* Hero */

.hero {
  padding-block: clamp(3rem, 9vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}

.hero-title {
  max-width: 22ch;
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.4rem);
  margin-top: 1.25rem;
}

.hero-lead {
  max-width: 44rem;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1.75rem 1.25rem;
}

/* Photo beside the text on wide screens, above it on phones. */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: center; }
.hero-photo {
  order: -1;
  width: 11rem;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent), 0 18px 40px -16px color-mix(in srgb, var(--accent) 55%, transparent);
}

@media (min-width: 52rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; }
  .hero-photo { order: 0; width: 18rem; }
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

/* Stats */

.stats {
  border-block: 1px solid var(--border);
  background: var(--surface);
}

.stats-grid {
  display: grid;
  gap: 1rem;
  padding-block: 1.5rem;
}

@media (min-width: 48rem) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.stat strong {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 800;
  color: var(--accent-strong);
  line-height: 1.3;
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .stat strong { color: var(--accent); }
}
:where(:root[data-theme="dark"]) .stat strong { color: var(--accent); }

.stat span { color: var(--muted); }

/* Timeline */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  display: grid;
  gap: 0.25rem 1.5rem;
  padding-block: 1rem;
  border-top: 1px solid var(--border);
}

.timeline-item:first-child { border-top: 0; }

@media (min-width: 48rem) {
  .timeline-item { grid-template-columns: 11rem 1fr; }
}

.timeline-dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.timeline-item h3 { margin-bottom: 0.35rem; }
.timeline-item p:last-child,
.timeline-item ul:last-child { margin-bottom: 0; }

/* Cards */

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem;
}

.card-body > :last-child { margin-bottom: 0; }

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover { text-decoration: underline; }

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: auto;
  font-weight: 700;
}

.project-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: var(--surface-strong);
}

.project-cover-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-strong));
  color: var(--accent);
  font-size: 3.5rem;
  font-weight: 800;
}

.badge {
  align-self: flex-start;
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .badge { color: var(--accent); }
}
:where(:root[data-theme="dark"]) .badge { color: var(--accent); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Case study */

.breadcrumb { font-size: 0.95rem; }

.case-study-head { margin-bottom: 2rem; }

.case-study-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 60rem) {
  .case-study-layout { grid-template-columns: minmax(0, 1fr) 18rem; }
}

.case-study-facts {
  align-self: start;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
}

.case-study-facts h2 {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.prose { max-width: 44rem; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-inline-start: 1.25rem; }

/* About */

.about-head { max-width: 48rem; margin-bottom: 1rem; }

.about-section {
  padding-block: 1.75rem;
  border-top: 1px solid var(--border);
}

.decisions {
  display: grid;
  gap: 1rem;
}

@media (min-width: 48rem) {
  .decisions { grid-template-columns: repeat(2, 1fr); }
}

.decisions > div {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
}

.decisions dt { font-weight: 700; margin-bottom: 0.25rem; }
.decisions dd { margin: 0; color: var(--muted); }

.stack > div {
  display: grid;
  gap: 0 1rem;
  padding-block: 0.5rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 48rem) {
  .stack > div { grid-template-columns: 13rem 1fr; }
}

.stack dt { font-weight: 700; }
.stack dd { margin: 0; color: var(--muted); }
.stack dd[dir="ltr"] { text-align: start; unicode-bidi: isolate; }

/* CTA */

.cta { text-align: center; }
.cta .narrow { margin-inline: auto; }

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-block: 2rem;
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer-inner p { margin: 0; }
.footer-available { font-weight: 700; flex-basis: 100%; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-copy { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Blog */

.blog-layout {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 60rem) {
  .blog-layout { grid-template-columns: minmax(0, 1fr) 17rem; }
}

.article-list {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 48rem) {
  .article-list-3 { grid-template-columns: repeat(3, 1fr); }
}

.article-card {
  display: grid;
  gap: 0.75rem;
}

.article-cover {
  display: block;
  width: 100%;
  aspect-ratio: 800 / 420;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.article-meta {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.article-meta a { color: inherit; }

.article-title {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.article-title a {
  color: inherit;
  text-decoration: none;
}

.article-title a:hover { text-decoration: underline; }

.blog-sidebar h2 {
  font-size: 1rem;
  margin-top: 1.5rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.category-list {
  list-style: none;
  padding: 0;
}

.category-list li {
  display: flex;
  justify-content: space-between;
  padding-block: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.category-list a { text-decoration: none; }
.category-list a[aria-current] { font-weight: 700; }

.pager {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 2.5rem;
}

.article {
  max-width: 48rem;
}

.article-head { margin-bottom: 2rem; }

.article-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius);
  margin-top: 1.25rem;
}

.prose { font-size: 1.05rem; overflow-wrap: break-word; }
/* Long inline identifiers (e.g. builder.Services.AddHostedService<T>()) must wrap, not widen the page on phones. */
.prose :not(pre) > code { overflow-wrap: anywhere; }
.prose h2 { margin-top: 2.25rem; }
.prose h3 { margin-top: 1.75rem; }
.prose img { border-radius: var(--radius); }
.prose ul, .prose ol { padding-inline-start: 1.5rem; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  display: block;
  overflow-x: auto;
}

.prose th, .prose td {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  text-align: start;
}

/* Code is always left-to-right, even inside Persian articles. */
pre {
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

pre code.hljs { padding: 0; background: transparent; }

.article-tags { margin-block: 2rem 1rem; }
.article-tags a { text-decoration: none; color: inherit; }

.faq {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.faq details {
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
}

.faq details p { margin: 0.5rem 0 0; color: var(--muted); }

.article-cta {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.article-cta p { margin: 0; }

.related { margin-top: 3rem; }

/* Forms */

.form { margin-top: 1.5rem; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  gap: 0 1rem;
}

@media (min-width: 40rem) {
  .form-row { grid-template-columns: repeat(3, 1fr); }
}

.form-field label { font-weight: 700; }

.form input:not([type=file]):not([type=checkbox]),
.form select,
.form textarea {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.form input:not([type=file]):not([type=checkbox]):hover,
.form select:hover,
.form textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

.form input:not([type=file]):not([type=checkbox]):focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.form .input-validation-error { border-color: var(--danger); }

.form textarea { resize: vertical; }

.form select {
  appearance: none;
  padding-inline-end: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a8590' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 0.75rem;
  background-position: right 0.9rem center;
  cursor: pointer;
}

[dir="rtl"] .form select { background-position: left 0.9rem center; }

.form-card {
  position: relative;
  padding: clamp(1.25rem, 1rem + 2vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.form-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.form-step:not(:first-of-type) {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

.form-step span {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.9rem;
}

:where(:root[data-theme="dark"]) .form-step span { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .form-step span { color: var(--accent); }
}

/* The real file input covers the zone (invisible), so click, keyboard and drag-and-drop all stay native. */
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.file-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-drop:hover,
.file-drop:focus-within,
.file-drop.is-dragover,
.file-drop.has-file {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  color: var(--accent);
}

.file-drop:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.file-drop-text { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.75rem;
}

.form-actions .form-hint { flex: 1 1 14rem; margin: 0; }

@media (max-width: 40rem) {
  .form-actions .button { width: 100%; }
}

.form-hint { color: var(--muted); font-size: 0.9rem; }
.form-error { color: var(--danger); font-size: 0.9rem; }
.form-error:empty { display: none; }

.form-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.form-alert:empty,
.form-alert.validation-summary-valid { display: none; }

/* Off-screen rather than display:none, so bots that skip hidden fields still see it. */
.form-honeypot {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Services */

.services-head { max-width: 48rem; }
.services-head .lead { margin-top: 0.5rem; }

.services-section {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
}

.services-head + .services-section { margin-top: 1.5rem; }

.steps {
  padding-inline-start: 1.5rem;
  display: grid;
  gap: 0.6rem;
}

/* highlight.js "github" theme: four token colors fall below 4.5:1 on our code background (#f5f7f8).
   Darker equivalents from GitHub's current light palette, measured at 4.98:1 or better. "pre" outranks the theme file, which loads later. */
@media (prefers-color-scheme: light) {
  :where(:root:not([data-theme="dark"])) pre .hljs-keyword, :where(:root:not([data-theme="dark"])) pre .hljs-doctag, :where(:root:not([data-theme="dark"])) pre .hljs-meta .hljs-keyword, :where(:root:not([data-theme="dark"])) pre .hljs-template-tag, :where(:root:not([data-theme="dark"])) pre .hljs-template-variable, :where(:root:not([data-theme="dark"])) pre .hljs-type, :where(:root:not([data-theme="dark"])) pre .hljs-variable.language_ { color: #cf222e; }
  :where(:root:not([data-theme="dark"])) pre .hljs-built_in, :where(:root:not([data-theme="dark"])) pre .hljs-symbol { color: #953800; }
  :where(:root:not([data-theme="dark"])) pre .hljs-name, :where(:root:not([data-theme="dark"])) pre .hljs-quote, :where(:root:not([data-theme="dark"])) pre .hljs-selector-tag, :where(:root:not([data-theme="dark"])) pre .hljs-selector-pseudo, :where(:root:not([data-theme="dark"])) pre .hljs-bullet, :where(:root:not([data-theme="dark"])) pre .hljs-addition { color: #116329; }
  :where(:root:not([data-theme="dark"])) pre .hljs-comment, :where(:root:not([data-theme="dark"])) pre .hljs-code, :where(:root:not([data-theme="dark"])) pre .hljs-formula { color: #57606a; }
}
:where(:root[data-theme="light"]) pre .hljs-keyword, :where(:root[data-theme="light"]) pre .hljs-doctag, :where(:root[data-theme="light"]) pre .hljs-meta .hljs-keyword, :where(:root[data-theme="light"]) pre .hljs-template-tag, :where(:root[data-theme="light"]) pre .hljs-template-variable, :where(:root[data-theme="light"]) pre .hljs-type, :where(:root[data-theme="light"]) pre .hljs-variable.language_ { color: #cf222e; }
:where(:root[data-theme="light"]) pre .hljs-built_in, :where(:root[data-theme="light"]) pre .hljs-symbol { color: #953800; }
:where(:root[data-theme="light"]) pre .hljs-name, :where(:root[data-theme="light"]) pre .hljs-quote, :where(:root[data-theme="light"]) pre .hljs-selector-tag, :where(:root[data-theme="light"]) pre .hljs-selector-pseudo, :where(:root[data-theme="light"]) pre .hljs-bullet, :where(:root[data-theme="light"]) pre .hljs-addition { color: #116329; }
:where(:root[data-theme="light"]) pre .hljs-comment, :where(:root[data-theme="light"]) pre .hljs-code, :where(:root[data-theme="light"]) pre .hljs-formula { color: #57606a; }

/* ------------------------------------------------------------------------------------------------
   Visual layer: soft colour glows, a faint grid behind the hero, and motion on cards.
   CSS only (no images, no JS), so it costs nothing on slow connections. Motion respects
   prefers-reduced-motion.
------------------------------------------------------------------------------------------------ */

:root {
  --glow-1: rgb(15 118 110 / 0.16);
  --glow-2: rgb(99 102 241 / 0.12);
  --glow-3: rgb(245 158 11 / 0.10);
  --grid-line: rgb(16 24 32 / 0.05);
  --gradient-text: linear-gradient(120deg, var(--accent) 10%, #6366f1 60%, #0ea5e9 95%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glow-1: rgb(45 212 191 / 0.14);
    --glow-2: rgb(129 140 248 / 0.14);
    --glow-3: rgb(251 191 36 / 0.07);
    --grid-line: rgb(255 255 255 / 0.045);
    --gradient-text: linear-gradient(120deg, #5eead4 10%, #a5b4fc 60%, #7dd3fc 95%);
  }
}
:root[data-theme="dark"] {
  --glow-1: rgb(45 212 191 / 0.14);
  --glow-2: rgb(129 140 248 / 0.14);
  --glow-3: rgb(251 191 36 / 0.07);
  --grid-line: rgb(255 255 255 / 0.045);
  --gradient-text: linear-gradient(120deg, #5eead4 10%, #a5b4fc 60%, #7dd3fc 95%);
}

/* Fixed, page-wide glows behind everything. */
body {
  position: relative;
  isolation: isolate;
  transition: background-color 0.3s ease, color 0.3s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 30rem at 85% -5%, var(--glow-1), transparent 70%),
    radial-gradient(35rem 28rem at 5% 20%, var(--glow-2), transparent 70%),
    radial-gradient(30rem 24rem at 60% 105%, var(--glow-3), transparent 70%);
}

/* Hero: a fading grid and two slowly drifting orbs. */
.hero {
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 2.75rem 2.75rem;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 30%, #000 30%, transparent 75%);
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block-start: -6rem;
  inset-inline-end: -4rem;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--glow-1), transparent 65%),
              radial-gradient(circle at 70% 70%, var(--glow-2), transparent 60%);
  filter: blur(10px);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-3rem, 2.5rem) scale(1.15); }
}

.hero-title {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Sections with the alt background become translucent so the glows show through. */
.section-alt { background: color-mix(in srgb, var(--surface) 75%, transparent); }
.site-footer { background: color-mix(in srgb, var(--surface) 85%, transparent); }

/* Cards: lift and an accent edge on hover. */
.card,
.article-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); }
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.project-cover,
.article-cover { transition: transform 0.5s ease; }
.card:hover .project-cover,
.article-card:hover .article-cover { transform: scale(1.03); }
.article-card > a:first-child { display: block; overflow: hidden; border-radius: var(--radius); }

/* Buttons: a soft glow on the primary action. */
.button-primary { transition: box-shadow 0.2s ease, transform 0.2s ease; }
.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* Fade later sections in as the page loads (not the first one: it holds the LCP element). */
main > section:not(:first-child) { animation: rise 0.6s ease both; }
main > section:nth-child(3) { animation-delay: 0.08s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Contact page */

.contact-head { max-width: 44rem; margin-bottom: 2rem; }
.contact-grid { display: grid; gap: 1.5rem; }
.contact-cards { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; align-content: start; }
.contact-card { flex-direction: row; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.contact-card p { margin: 0; }
.contact-label { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.contact-card a { font-weight: 700; font-size: 1.05rem; }
.contact-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.8rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.contact-form-card h2 { margin-top: 0; }
.contact-form-card:hover { transform: none; }
@media (min-width: 52rem) {
  .contact-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}

/* Blog index: cover beside the text on wide screens, so the list stays scannable. */
@media (min-width: 48rem) {
  .article-list:not(.article-list-3) .article-card {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
  }
}

/* Card titles look the same whether the heading level is h2 or h3. */
.card-title { font-size: 1.2rem; }
