/* ════════════════════════════════════════════════════════════════════════
   Minimal editorial theme, premium pass - light, single accent.
   Public styles scoped under `.site`; the dark admin (which shares this file
   via _AdminLayout) keeps its own dark classes at the bottom (.glass etc).
   Dials: VARIANCE 7 / MOTION 5 / DENSITY 3.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #fafafa;
  --surface:      #ffffff;
  --text:         #18181b;  /* zinc-900 */
  --text-2:       #52525b;  /* zinc-600 */
  --text-3:       #71717a;  /* zinc-500 - meets WCAG AA 4.5:1 on the off-white bg */
  --line:         #e4e4e7;  /* zinc-200 */
  --line-strong:  #d4d4d8;  /* zinc-300 */
  --accent:       #2563eb;  /* blue-600 - the single accent */
  --accent-ink:   #1d4ed8;  /* blue-700 */
  --accent-weak:  #eff4ff;
  --accent-line:  #c7d2fe;  /* indigo-200, for hover borders */
  --ok:           #16a34a;  /* availability indicator only */
  --radius:       8px;
  --nav-h:        4.25rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }

::selection { background: #dbe5ff; color: #18181b; }

a:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

::-webkit-scrollbar       { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid var(--bg); }

/* ─── Public base (scoped to .site) ──────────────────────────────────── */
body.site {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Vazirmatn', sans-serif;
  font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[dir='rtl'] body.site { font-family: 'Vazirmatn', system-ui, sans-serif; }

.site h1, .site h2, .site h3, .site h4 {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.12; text-wrap: balance;
}
[dir='rtl'] .site h1, [dir='rtl'] .site h2,
[dir='rtl'] .site h3, [dir='rtl'] .site h4 {
  font-family: 'Vazirmatn', system-ui, sans-serif; letter-spacing: 0;
}

/* anchor targets clear the fixed navbar */
.site section[id] { scroll-margin-top: var(--nav-h); }

.accent-text { color: var(--accent); }

/* thin reading-progress bar (CSS scroll-driven; degrades to nothing) */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: var(--accent); transform-origin: left center; transform: scaleX(0);
  animation: sp-grow linear both; animation-timeline: scroll(root);
}
[dir='rtl'] .scroll-progress { transform-origin: right center; }
@keyframes sp-grow { to { transform: scaleX(1); } }

/* ─── Navigation ─────────────────────────────────────────────────────── */
#navbar { transition: background .25s ease, border-color .25s ease; border-bottom: 1px solid transparent; }
#navbar.scrolled { background: rgba(250,250,250,.82); backdrop-filter: blur(12px); border-bottom-color: var(--line); }

.nav-link { position: relative; font-size: .9rem; color: var(--text-2); transition: color .18s ease; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1.5px;
  background: var(--text); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
[dir='rtl'] .nav-link::after { transform-origin: right; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ─── Buttons (one shape: 8px radius, no pills, no glow) ──────────────── */
.btn, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.2rem; border-radius: var(--radius);
  font-weight: 600; font-size: .92rem;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn:hover, .btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); box-shadow: 0 8px 24px -10px rgba(37,99,235,.5); }
.btn:active, .btn-primary:active { transform: translateY(1px); }
.btn svg { transition: transform .2s ease; }
.btn:hover svg { transform: translateX(3px); }
[dir='rtl'] .btn:hover svg { transform: translateX(-3px); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.2rem; border-radius: var(--radius);
  font-weight: 500; font-size: .92rem;
  color: var(--text); background: transparent; border: 1px solid var(--line-strong);
  transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.btn-ghost:hover { border-color: var(--text); background: #fff; }
.btn-ghost:active { transform: translateY(1px); }

/* pointer affordance + disabled semantics (ui-ux-pro-max: cursor-pointer, disabled-states) */
.site button { cursor: pointer; }
.site button:disabled { cursor: not-allowed; opacity: .55; }

/* ─── Availability status ────────────────────────────────────────────── */
.status {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--text-2);
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: .32rem .7rem;
}
.status .dot { position: relative; width: 7px; height: 7px; border-radius: 999px; background: var(--ok); }
.status .dot::after { content: ""; position: absolute; inset: 0; border-radius: 999px; background: var(--ok); opacity: .55; animation: ping 1.9s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 70%, 100% { transform: scale(2.4); opacity: 0; } }

/* ─── Social ─────────────────────────────────────────────────────────── */
.social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text-2); transition: color .18s ease, border-color .18s ease, transform .18s ease;
}
.social:hover { color: var(--text); border-color: var(--text); transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; }

/* ─── Type helpers ───────────────────────────────────────────────────── */
.kicker { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
[dir='rtl'] .kicker { letter-spacing: .06em; }
.lede { color: var(--text-2); font-size: 1.05rem; line-height: 1.7; max-width: 44rem; }

.sec-head { margin-bottom: 3rem; max-width: 46rem; }
.sec-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.sec-head .lede { margin-top: .9rem; }

.arrow-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--accent); font-weight: 500; font-size: .85rem; }
.arrow-link svg { transition: transform .2s ease; }
.arrow-link:hover svg, .group:hover .arrow-link svg { transform: translateX(3px); }
[dir='rtl'] .arrow-link:hover svg, [dir='rtl'] .group:hover .arrow-link svg { transform: translateX(-3px); }

/* ─── Neutral tag chip (one shape) ───────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 6px;
  padding: .2rem .55rem; font-size: .72rem; color: var(--text-2);
  background: #fff; white-space: nowrap;
}

/* ─── Service blocks (animated accent top-rule on hover) ─────────────── */
.svc { position: relative; }
.svc::before {
  content: ""; position: absolute; inset-block-start: -1px; inset-inline: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
[dir='rtl'] .svc::before { transform-origin: right; }
.svc:hover::before { transform: scaleX(1); }
.svc:hover .svc-icon { color: var(--accent); }
.svc-icon { transition: color .2s ease; }

/* ─── Surface card (portfolio, contact) ──────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-link { transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.card-link:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: 0 16px 40px -24px rgba(24,24,27,.35); }
.cover { overflow: hidden; }
.cover > * { transition: transform .45s cubic-bezier(.22,1,.36,1); }
.card-link:hover .cover > * { transform: scale(1.04); }

/* ─── Bento grid (Apple-style tiles, varied spans) ───────────────────── */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); grid-auto-rows: minmax(158px, auto); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 1.5rem; overflow: hidden;
  transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s ease, border-color .22s ease;
}
.tile-link { cursor: pointer; }
.tile-link:hover { transform: translateY(-4px); box-shadow: 0 22px 48px -26px rgba(24,24,27,.4); border-color: var(--line-strong); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.row-2 { grid-row: span 2; }
.tile-dark   { background: #18181b; border-color: #18181b; }
.tile-accent { background: var(--accent); border-color: var(--accent); }
.tile-tint   { background: var(--accent-weak); border-color: #dbe3ff; }
.tile-icon { color: var(--accent); }
.tile-dark .tile-icon, .tile-accent .tile-icon { color: #fff; }
.tile-dark h1, .tile-dark h2, .tile-dark h3, .tile-accent h1, .tile-accent h2, .tile-accent h3 { color: #fafafa; }
.t-sub { color: #d4d4d8; }
.tile-accent .t-sub { color: rgba(255,255,255,.85); }
.btn-on-dark { color: #fafafa; background: transparent; border-color: rgba(255,255,255,.28); }
.btn-on-dark:hover { color: #fafafa; background: rgba(255,255,255,.08); border-color: #fafafa; }
.pcover { display: flex; align-items: center; justify-content: center; }
@media (max-width: 1023px) {
  .bento { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .span-3, .span-4 { grid-column: span 2; }
}
@media (max-width: 639px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .row-2 { grid-row: span 1; }
}

/* ─── Form fields ────────────────────────────────────────────────────── */
.flabel { display: block; font-size: .85rem; font-weight: 500; color: var(--text-2); margin-bottom: .4rem; }
.field {
  width: 100%; font-family: inherit; font-size: .92rem; color: var(--text);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .7rem .85rem; transition: border-color .18s ease, box-shadow .18s ease;
}
.field::placeholder { color: var(--text-3); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* ─── Footer ─────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.foot-link { color: var(--text-2); font-size: .9rem; transition: color .18s ease; }
.foot-link:hover { color: var(--text); }

/* ─── Scroll reveal (MOTION 5: subtle, transform+opacity only) ───────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .7s cubic-bezier(.22,1,.36,1); }
.reveal.visible { opacity: 1; transform: none; }

/* ─── Blog prose ─────────────────────────────────────────────────────── */
.prose-custom { color: var(--text-2); line-height: 1.8; font-size: 1.02rem; }
.prose-custom h2, .prose-custom h3 { color: var(--text); font-family: 'Syne', system-ui, sans-serif; margin: 2rem 0 .6rem; }
[dir='rtl'] .prose-custom h2, [dir='rtl'] .prose-custom h3 { font-family: 'Vazirmatn', system-ui, sans-serif; }
.prose-custom p { margin-bottom: 1.2rem; }
.prose-custom a { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
.prose-custom strong { color: var(--text); }
.prose-custom code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; background: #f4f4f5; border: 1px solid var(--line); border-radius: 5px; padding: .12em .4em; font-size: .88em; color: #3f3f46; }
.prose-custom pre { background: #f4f4f5; border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem; overflow-x: auto; margin: 1.4rem 0; }
.prose-custom pre code { background: none; border: 0; padding: 0; color: #27272a; }
.prose-custom ul, .prose-custom ol { padding-inline-start: 1.4rem; margin-bottom: 1.2rem; }
.prose-custom li { margin-bottom: .4rem; }
.prose-custom blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 1rem; color: var(--text-2); margin: 1.4rem 0; }

/* ════════════════════════════════════════════════════════════════════════
   Admin (dark) - preserved. _AdminLayout has its own dark Tailwind config;
   these classes keep working on its dark surface. Do not light-theme these.
   ════════════════════════════════════════════════════════════════════════ */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,.05);
}
.label-mono {
  font-family: 'SpaceMono', ui-monospace, monospace;
  font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #94a3b8;
}
.admin-nav-link {
  display: block; padding: .5rem .75rem; border-radius: .5rem;
  color: #94a3b8; font-size: .875rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-nav-link:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.admin-nav-link.active { background: rgba(56,189,248,.1); color: #38bdf8; }

/* ─── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .scroll-progress { display: none; }
}
