/* ==========================================================================
   adavoudi.info — design system
   Dark, warm-on-ink. Amber = refined data, cyan/violet = raw data.
   ========================================================================== */

:root {
  --bg: #07090f;
  --bg-2: #0d111a;
  --bg-3: #131925;
  --fg: #ece9e2;
  --fg-dim: #b4bbc8;
  --muted: #8a93a4;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);

  --amber: #ffb45c;
  --amber-deep: #ff9a2e;
  --coral: #ef6f5e;
  --cyan: #62e6d5;
  --violet: #8b7bff;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-text: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 5vw, 56px);
  --radius: 14px;
  --nav-h: 68px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 var(--font-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(255, 180, 92, 0.35); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--amber); color: #1a1205; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { left: 8px; }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.ico--flip { transform: scaleX(-1); }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
h2 { font-size: clamp(2rem, 4.4vw, 3.2rem); }
p { margin: 0 0 1em; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
  font: 500 12.5px/1 var(--font-mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--amber);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(98, 230, 213, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(98, 230, 213, 0); } 100% { box-shadow: 0 0 0 0 rgba(98, 230, 213, 0); } }

.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.6; color: var(--fg-dim); max-width: 34em; }

.wrap { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.wrap--narrow { width: min(760px, 100% - 2 * var(--gutter)); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg); text-decoration: none;
  font: 500 15px/1 var(--font-text);
  transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
  backdrop-filter: blur(6px);
}
.btn:hover { transform: translateY(-2px); border-color: var(--amber); background: rgba(255, 180, 92, 0.08); }
.btn--primary { background: var(--amber); border-color: var(--amber); color: #1a1205; font-weight: 600; }
.btn--primary:hover { background: #ffc582; border-color: #ffc582; color: #1a1205; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gutter);
  background: linear-gradient(to bottom, rgba(7, 9, 15, .85), rgba(7, 9, 15, 0));
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
          mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.nav__brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 600 15px/1 var(--font-display); letter-spacing: .01em; }
.nav__mark { display: inline-grid; grid-auto-flow: column; gap: 3px; align-items: end; height: 18px; }
.nav__mark i { width: 4px; border-radius: 2px; background: var(--amber); animation: eq 1.6s ease-in-out infinite; }
.nav__mark i:nth-child(1) { height: 8px; background: var(--cyan); }
.nav__mark i:nth-child(2) { height: 18px; animation-delay: -.5s; }
.nav__mark i:nth-child(3) { height: 12px; animation-delay: -1s; }
@keyframes eq { 50% { transform: scaleY(.55); } }
.nav__links { display: flex; align-items: center; gap: clamp(14px, 2.6vw, 30px); font-size: 14.5px; }
.nav__links a { text-decoration: none; color: var(--fg-dim); transition: color .2s; }
.nav__links a:hover, .nav__links a[aria-current] { color: var(--fg); }
.nav__cta { color: var(--fg) !important; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; }
.nav__cta:hover { border-color: var(--amber); }

/* ---------- Canvas ---------- */
.scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; pointer-events: none; }
.page-home main { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 24px) var(--gutter) 90px;
}
.hero__copy { max-width: 590px; position: relative; z-index: 2; }
.hero__name { font-size: clamp(3.4rem, 9.5vw, 7.4rem); line-height: .92; letter-spacing: -0.045em; font-weight: 700; margin-bottom: 26px; }
.hero__name span { display: block; }
.hero__name span:last-child { background: linear-gradient(95deg, var(--amber) 0%, var(--coral) 60%, var(--violet) 130%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__fallback { position: absolute; right: 2vw; bottom: 0; width: min(54vw, 640px); height: auto; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.js:not(.no-webgl) .hero__fallback { opacity: 0; pointer-events: none; }
.hero__hint { position: absolute; left: var(--gutter); bottom: 28px; margin: 0; font: 400 12px/1 var(--font-mono); color: var(--muted); letter-spacing: .04em; }

.hero__copy > * { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero__copy > :nth-child(2) { animation-delay: .12s; }
.hero__copy > :nth-child(3) { animation-delay: .24s; }
.hero__copy > :nth-child(4) { animation-delay: .36s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- Pipeline (pinned scroll scene) ---------- */
.pipeline { position: relative; padding: 12vh var(--gutter); }
.panel { max-width: 470px; }
.panel h2 { margin-bottom: 18px; }
.stage h3 { font-size: clamp(2.2rem, 4vw, 3.1rem); margin-bottom: 10px; }
.stage__num { font: 500 13px/1 var(--font-mono); color: var(--amber); letter-spacing: .12em; margin-bottom: 16px; }
.stage__num span { color: var(--muted); margin-left: 6px; }
.stage__kicker { font: 500 1.2rem/1.35 var(--font-display); color: var(--fg); margin-bottom: 14px; }
.stage p:not(.stage__kicker):not(.stage__num) { color: var(--fg-dim); font-size: 16.5px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 18px 0; }
.tags li { font: 400 12.5px/1 var(--font-mono); padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--fg-dim); background: rgba(255, 255, 255, .03); }
.refs { list-style: none; padding: 14px 0 0; margin: 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 14.5px; }
.refs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; line-height: 1.4; }
.refs__kind { font: 500 10.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); min-width: 44px; }
.refs a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.refs a:hover { text-decoration-color: var(--amber); color: var(--amber); }
.refs em { color: var(--muted); font-style: normal; font-size: 13px; flex-basis: 100%; padding-left: 44px; }

.progress, .labels { display: none; }
.panel + .panel, .pipeline .stage { margin-top: 56px; }

/* pinned layout: only when JS + WebGL are available */
.js:not(.no-webgl) .pipeline { height: 560vh; padding: 0; }
.js:not(.no-webgl) .pipeline__sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.js:not(.no-webgl) .panel {
  position: absolute; left: var(--gutter); top: 50%;
  width: min(470px, 100% - 2 * var(--gutter)); margin: 0;
  transform: translateY(calc(-50% + 24px));
  opacity: 0; visibility: hidden;
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1), visibility 0s .55s;
}
.js:not(.no-webgl) .panel.is-active { opacity: 1; visibility: visible; transform: translateY(-50%); transition-delay: 0s; }
.js:not(.no-webgl) .panel::before {
  content: ""; position: absolute; inset: -90px -120px -90px calc(var(--gutter) * -1); z-index: -1;
  background: radial-gradient(ellipse closest-side at 38% 50%, rgba(7, 9, 15, .94) 0%, rgba(7, 9, 15, .82) 55%, rgba(7, 9, 15, 0) 100%);
}
.js:not(.no-webgl) .progress {
  display: grid; gap: 18px; list-style: none; margin: 0; padding: 0;
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
}
.progress li { position: relative; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; transition: background .3s, border-color .3s, transform .3s; }
.progress li span { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 400 11.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); opacity: 0; transition: opacity .3s; }
.progress li.is-active { background: var(--amber); border-color: var(--amber); transform: scale(1.35); }
.js:not(.no-webgl) .labels { display: block; position: absolute; inset: 0; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; font: 500 11.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); padding: 6px 9px; border: 1px solid rgba(255, 180, 92, .35); border-radius: 6px; background: rgba(7, 9, 15, .6); backdrop-filter: blur(4px); opacity: 0; transition: opacity .4s; will-change: transform; }

/* ---------- Certifications ---------- */
.certs { background: var(--bg); padding-bottom: clamp(40px, 6vw, 80px); }
.certs__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px; }
.cert { text-align: center; padding: 30px 20px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)); transition: transform .35s cubic-bezier(.2, .7, .2, 1), border-color .3s; }
.cert:hover { transform: translateY(-6px); border-color: rgba(255, 180, 92, .45); }
.badge { width: 132px; height: auto; overflow: visible; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .5)); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.cert:hover .badge { transform: scale(1.07) rotate(-3deg); }
.badge__code { font: 700 27px var(--font-display); letter-spacing: -.02em; }
.badge__ring { transform-origin: 60px 66px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cert__name { margin: 18px 0 6px; font-size: 15px; line-height: 1.35; color: var(--fg-dim); }
.cert__name strong { color: var(--fg); font: 600 1.1rem/1.3 var(--font-display); }
.cert__level { margin: 0; font: 500 11.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }

/* ---------- Sections ---------- */
.section { position: relative; padding: clamp(80px, 12vw, 150px) 0; }
.writing { background: var(--bg); }
.section__head { margin-bottom: 48px; max-width: 640px; }
.section__head h2 { margin-bottom: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
  overflow: hidden;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), border-color .3s, background .3s;
}
.card:hover { transform: translateY(-5px); border-color: rgba(255, 180, 92, .5); background: linear-gradient(180deg, rgba(255, 180, 92, .07), rgba(255, 255, 255, .015)); }
.card__media { display: grid; place-items: center; aspect-ratio: 16 / 9; background: radial-gradient(circle at 30% 20%, #1a2233, #0b0f17); padding: 14px; overflow: hidden; }
.card__media img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card__media img { transform: scale(1.04); }
.card__body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 24px; flex: 1; }
.card__meta { display: flex; gap: 12px; font: 400 12px/1 var(--font-mono); color: var(--muted); letter-spacing: .04em; }
.card__title { font: 600 1.18rem/1.28 var(--font-display); letter-spacing: -.01em; color: var(--fg); }
.card__excerpt { font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.more { margin-top: 40px; }

.contact { text-align: center; background: radial-gradient(ellipse at 50% 100%, rgba(255, 140, 60, .12), transparent 60%), var(--bg); }
.contact__inner { display: flex; flex-direction: column; align-items: center; }
.contact h2 { font-size: clamp(2.2rem, 5.4vw, 4rem); margin-bottom: 22px; }
.contact .lead { margin-inline: auto; }
.contact .actions { justify-content: center; }

/* ---------- Simple pages (blog index, 404) ---------- */
.page-head { padding: calc(var(--nav-h) + 70px) 0 50px; max-width: 720px; }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); margin-bottom: 20px; }
.page-simple main, .page-post main { min-height: 70vh; }
.page-simple .cards--all { padding-bottom: 110px; }
.lost { padding: calc(var(--nav-h) + 120px) 0 140px; }
.lost h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); margin-bottom: 20px; }
.lost a, .prose a { color: var(--amber); text-underline-offset: 3px; }

/* ---------- Post ---------- */
.post__head { padding: calc(var(--nav-h) + 56px) 0 36px; }
.back { display: inline-flex; align-items: center; gap: 8px; font: 400 13px/1 var(--font-mono); color: var(--muted); text-decoration: none; margin-bottom: 36px; letter-spacing: .04em; }
.back:hover { color: var(--amber); }
.post__meta { display: flex; gap: 10px; font: 400 13px/1 var(--font-mono); color: var(--amber); letter-spacing: .06em; margin-bottom: 16px; }
.post__head h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.08; text-wrap: balance; }

.prose { font-size: 1.07rem; line-height: 1.78; color: #d7dae1; padding-bottom: 40px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: clamp(1.55rem, 3vw, 2rem); margin: 2.4em 0 .6em; padding-top: .4em; }
.prose h3 { font-size: 1.3rem; margin: 2em 0 .5em; }
.prose h4 { font-size: 1.08rem; margin: 1.6em 0 .4em; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote, .prose figure { margin: 0 0 1.3em; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose a:hover { color: #ffc582; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--amber); }
.prose img { display: block; height: auto; margin: 1.8em auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.prose blockquote { border-left: 3px solid var(--amber); padding: .2em 0 .2em 1.2em; color: var(--fg-dim); font-style: italic; }
.prose blockquote p:last-child { margin: 0; }
.prose code { font: 400 .86em/1.4 var(--font-mono); background: rgba(255, 255, 255, .07); padding: .16em .4em; border-radius: 5px; color: #ffd9a8; }
.prose pre { overflow-x: auto; background: #0b0f17; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; font-size: 14px; line-height: 1.6; tab-size: 2; }
.prose pre code, .prose .highlight code { background: none; padding: 0; color: #d7dae1; font-size: inherit; }
.prose .highlight { margin: 0 0 1.3em; }
.prose .highlight pre { margin: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .94rem; width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; vertical-align: top; }
.prose th { background: rgba(255, 255, 255, .05); font-family: var(--font-display); font-weight: 600; color: var(--fg); }
.prose tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }

.post__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 30px 0 120px; border-top: 1px solid var(--line); margin-top: 20px; }
.pn { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: border-color .25s, transform .25s; }
.pn:hover { border-color: rgba(255, 180, 92, .5); transform: translateY(-3px); }
.pn span { font: 400 11.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.pn strong { font: 600 1rem/1.3 var(--font-display); }
.pn--next { text-align: right; grid-column: 2; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 1; background: var(--bg); border-top: 1px solid var(--line); padding: 48px 0 56px; }
.footer__inner { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; display: grid; gap: 20px; }
.footer__line { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; }
.footer__line span { color: var(--muted); }
.footer__links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; }
.footer__links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg-dim); font-size: 15px; }
.footer__links a:hover { color: var(--amber); }
.footer__fine { margin: 0; font: 400 12px/1.5 var(--font-mono); color: var(--muted); }

/* ---------- Rouge (syntax highlighting) ---------- */
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs, .highlight .cp, .highlight .cd { color: #6b7488; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kc { color: #c79bff; }
.highlight .o, .highlight .ow { color: #9fb0c8; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss { color: #9ee6a6; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .il, .highlight .mo, .highlight .mb { color: #ffb45c; }
.highlight .nf, .highlight .fm, .highlight .nx { color: #7cc4ff; }
.highlight .nc, .highlight .nn, .highlight .no { color: #ffd9a8; }
.highlight .nt, .highlight .na { color: #7cc4ff; }
.highlight .nb, .highlight .bp { color: #62e6d5; }
.highlight .nv, .highlight .vi, .highlight .vc, .highlight .vg { color: #ef9a8f; }
.highlight .p { color: #b4bbc8; }
.highlight .err { color: #ff8a80; }
.highlight .gh, .highlight .gu { color: #ffd9a8; font-weight: 600; }
.highlight .gd { color: #ff8a80; }
.highlight .gi { color: #9ee6a6; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  body { font-size: 16.5px; }
  .nav__links a:not(.nav__cta):not(:nth-child(2)) { display: none; }
  .hero { align-items: flex-end; padding-bottom: 96px; }
  .hero__fallback { width: 86vw; right: 50%; transform: translateX(50%); bottom: auto; top: 12vh; }
  .hero__hint { display: none; }
  .hero__name { font-size: clamp(3rem, 15vw, 4.6rem); }
  .js:not(.no-webgl) .panel {
    top: auto; bottom: 28px; transform: translateY(24px);
  }
  .js:not(.no-webgl) .panel.is-active { transform: none; }
  .js:not(.no-webgl) .panel::before { inset: -120px -40px -40px -40px; background: linear-gradient(to top, rgba(7, 9, 15, .92) 35%, rgba(7, 9, 15, 0)); }
  .js:not(.no-webgl) .panel--intro { top: 16vh; bottom: auto; }
  .js:not(.no-webgl) .panel--intro::before { inset: -40px; background: radial-gradient(closest-side, rgba(7, 9, 15, .8), transparent); }
  .stage p:not(.stage__kicker):not(.stage__num) { font-size: 15px; line-height: 1.55; }
  .stage h3 { font-size: 2rem; }
  .refs li:nth-child(n+3) { display: none; }
  .tags { margin: 12px 0; }
  .js:not(.no-webgl) .progress { top: 20vh; right: 14px; transform: none; gap: 12px; }
  .progress li span { display: none; }
  .post__nav { grid-template-columns: 1fr; }
  .pn--next { grid-column: 1; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
