/* ==========================================================================
   AZ — Abdullah Zare · Personal Portfolio
   style.css — Design tokens, base typography, layout, header/footer, motion
   Pure CSS · No frameworks · RTL-first
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (self-hosted; Inter handles Latin, Vazirmatn handles Persian —
      the stack order makes the browser fall back per-glyph automatically)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter Variable";
  src: url("../assets/fonts/Inter-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Design tokens — Light (default)
   -------------------------------------------------------------------------- */
:root {
  /* Warm neutral surfaces */
  --bg: #faf9f5;
  --bg-soft: #f3f1eb;
  --bg-card: #ffffff;
  --code-bg: #f1efe8;

  /* Ink */
  --text: #17181c;
  --text-2: #6e7178;
  --text-3: #9a9da5;

  /* Sophisticated indigo accent */
  --accent: #4353ff;
  --accent-strong: #2f3fd6;
  --accent-soft: rgba(67, 83, 255, 0.08);

  /* Lines */
  --border: #e7e4dc;
  --border-strong: #d6d3ca;

  /* Type */
  --font-sans: "Inter Variable", "Vazirmatn", -apple-system, "Segoe UI", Tahoma, sans-serif;

  /* Rhythm */
  --container: 1120px;
  --narrow: 760px;
  --radius: 10px;
  --radius-sm: 7px;
  --header-h: 72px;

  --shadow-soft: 0 1px 2px rgba(23, 24, 28, 0.04), 0 10px 30px rgba(23, 24, 28, 0.05);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light;
}

/* --------------------------------------------------------------------------
   3. Design tokens — Dark
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #0f1114;
  --bg-soft: #14171b;
  --bg-card: #16191e;
  --code-bg: #1a1e24;

  --text: #eceae4;
  --text-2: #a3a6ad;
  --text-3: #71747c;

  --accent: #99a3ff;
  --accent-strong: #b3baff;
  --accent-soft: rgba(153, 163, 255, 0.1);

  --border: #24272d;
  --border-strong: #343841;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   4. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.9; /* comfortable for Persian body text */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0;
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent);
  color: #fff;
}

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

/* Latin runs (emails, URLs, usernames) keep correct direction inside RTL text */
.ltr {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100%;
  z-index: 200;
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 0.75rem;
}

/* --------------------------------------------------------------------------
   5. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * clamp(1.25rem, 5vw, 2.5rem));
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

.container-narrow {
  max-width: calc(var(--narrow) + 2 * clamp(1.25rem, 5vw, 2.5rem));
}

.section {
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.section + .section {
  padding-top: 0;
}

.section-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* --------------------------------------------------------------------------
   6. Section headers — editorial kicker + title
   -------------------------------------------------------------------------- */
.section-head {
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  direction: ltr;
}
.kicker::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
}

.section-title {
  margin-top: 0.9rem;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.4;
}

.section-lead {
  margin-top: 1rem;
  max-width: 62ch;
  color: var(--text-2);
  font-size: 1.02rem;
}

.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   7. Site header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
}
.brand-name {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}
.brand-name small {
  display: block;
  font-weight: 500;
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.08em;
  direction: ltr;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}
.main-nav a {
  position: relative;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-2);
  padding-block: 0.4rem;
  transition: color 0.2s var(--ease);
}
.main-nav a:hover {
  color: var(--text);
}
.main-nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s var(--ease);
}
.main-nav a:hover::after {
  transform: scaleX(0.5);
}
.main-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}
.main-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-2);
  background: transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-soft);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Theme toggle icons swap with data-theme */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.menu-btn { display: none; }
[data-menu-open] .icon-burger { display: none; }
[data-menu-open] .icon-close { display: block; }

/* --------------------------------------------------------------------------
   8. Hero
   -------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(4rem, 11vw, 8rem) clamp(3.5rem, 9vw, 6.5rem);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 0.45rem 1rem;
}
.hero-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px var(--accent-soft); }
}

.hero-title {
  margin-top: 1.6rem;
  font-size: clamp(2.7rem, 8vw, 4.9rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.hero-latin {
  margin-top: 0.9rem;
  direction: ltr;
  text-align: right;
  font-weight: 600;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero-headline {
  margin-top: 1.7rem;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.7;
}
.hero-headline em {
  font-style: normal;
  color: var(--accent);
}

.hero-intro {
  margin-top: 1.1rem;
  max-width: 62ch;
  color: var(--text-2);
  font-size: 1.02rem;
}
.hero-intro-en {
  margin-top: 0.8rem;
  max-width: 62ch;
  direction: ltr;
  text-align: right;
  color: var(--text-3);
  font-size: 0.88rem;
  line-height: 1.75;
}

.hero-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.3rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.85rem;
}
.hero-meta b {
  color: var(--text-2);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   9. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 8vw, 5rem);
  background: var(--bg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-block: clamp(2.5rem, 6vw, 3.5rem);
}

.footer-brand .brand-logo {
  width: 44px;
  height: 44px;
}
.footer-tagline {
  margin-top: 1rem;
  color: var(--text-2);
  font-size: 0.92rem;
  max-width: 34ch;
}

.footer-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.1rem;
}

.footer-list li + li {
  margin-top: 0.55rem;
}
.footer-list a {
  color: var(--text-2);
  font-size: 0.92rem;
  transition: color 0.2s var(--ease);
}
.footer-list a:hover {
  color: var(--accent);
}
.footer-list .muted {
  color: var(--text-3);
  font-size: 0.92rem;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-block: 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.82rem;
}
.footer-bottom .ltr {
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   10. Motion — reveal on scroll, page transitions
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}
.js .reveal.in-view {
  opacity: 1;
  transform: none;
}

/* Subtle cross-page fade (MPA view transitions where supported) */
@view-transition {
  navigation: auto;
}

/* Theme change animation — applied briefly by theme.js */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.28s var(--ease), color 0.28s var(--ease),
    border-color 0.28s var(--ease), fill 0.28s var(--ease), stroke 0.28s var(--ease) !important;
}

/* --------------------------------------------------------------------------
   11. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}


/* --------------------------------------------------------------------------
   12. AZ Ocean identity — luminous deep-sea signature
   -------------------------------------------------------------------------- */
:root {
  --accent: #087f8c;
  --accent-strong: #06636e;
  --accent-soft: rgba(8, 127, 140, 0.10);
  --ocean-deep: #042d3b;
  --ocean-mid: #087f8c;
  --ocean-light: #d8f2f1;
}
[data-theme="dark"] {
  --accent: #69d4d2;
  --accent-strong: #8be5df;
  --accent-soft: rgba(105, 212, 210, 0.14);
  --ocean-deep: #031b27;
  --ocean-mid: #0b6671;
  --ocean-light: #123b46;
}

/* The hero artwork is an abstract underwater current, not a generic wave icon. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 78% 24%, rgba(30, 166, 172, 0.16), transparent 34%),
    radial-gradient(ellipse at 8% 88%, rgba(8, 127, 140, 0.10), transparent 42%),
    linear-gradient(145deg, transparent 35%, rgba(8, 127, 140, 0.045) 100%);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.hero::before {
  z-index: 0;
  top: -18%;
  inset-inline-end: -7%;
  width: min(74vw, 880px);
  height: 128%;
  opacity: .92;
  background:
    radial-gradient(ellipse at 53% 45%, rgba(94, 226, 219, .28) 0 1.2%, transparent 1.8%),
    radial-gradient(ellipse at 53% 45%, rgba(19, 151, 160, .16) 0 9%, transparent 35%),
    repeating-radial-gradient(ellipse at 53% 45%, transparent 0 22px, rgba(14, 139, 150, .18) 23px 24px, transparent 25px 42px),
    radial-gradient(ellipse at 53% 45%, transparent 0 28%, rgba(5, 100, 117, .12) 28.3% 28.7%, transparent 29% 42%, rgba(5, 100, 117, .10) 42.3% 42.7%, transparent 43%);
  -webkit-mask-image: radial-gradient(ellipse at 53% 45%, #000 0 42%, rgba(0,0,0,.72) 60%, transparent 78%);
  mask-image: radial-gradient(ellipse at 53% 45%, #000 0 42%, rgba(0,0,0,.72) 60%, transparent 78%);
  transform: rotate(-13deg);
}
.hero::after {
  z-index: 0;
  inset-inline: -8%;
  bottom: -8.5rem;
  height: clamp(12rem, 29vw, 23rem);
  opacity: .95;
  background:
    radial-gradient(115% 115% at 50% 100%, rgba(8, 127, 140, .24) 0 39%, transparent 39.5%),
    radial-gradient(105% 108% at 63% 100%, rgba(8, 127, 140, .19) 0 43%, transparent 43.5%),
    radial-gradient(95% 100% at 34% 100%, rgba(8, 127, 140, .14) 0 47%, transparent 47.5%),
    repeating-radial-gradient(ellipse at 50% 100%, transparent 0 17px, rgba(9, 132, 145, .12) 18px 19px, transparent 20px 34px);
  transform: rotate(-2deg);
}
.hero > .container {
  position: relative;
  z-index: 1;
}
.hero-status {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  backdrop-filter: blur(8px);
}
.hero-status .dot { background: var(--accent); }
.hero-title { text-wrap: balance; }
.hero-headline em { color: var(--accent); }
.section-rule {
  border-top-color: color-mix(in srgb, var(--accent) 18%, var(--border));
}
.project-row:hover,
.article-row:hover {
  background: color-mix(in srgb, var(--accent-soft) 65%, var(--bg-soft));
}
.icon-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border-strong));
}
.btn-primary:hover { background: var(--accent-strong); }
::selection { background: var(--accent); color: #fff; }

@media (max-width: 640px) {
  .hero::before {
    width: 112vw;
    height: 76%;
    top: 0;
    inset-inline-end: -34%;
    opacity: .48;
  }
  .hero::after { opacity: .72; }
}
@media (prefers-reduced-motion: reduce) {
  .hero::before,
  .hero::after { transform: none; }
}


