/* =====================================================
   Palette: سبز جنگلی جَنگو + زعفران
   Type:    Lalezar (تیتر) + Vazirmatn (متن)
   ===================================================== */
@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  --bg: #07211a;
  --bg-deep: #041510;
  --text: #efeadf;
  --muted: #8fae9f;
  --accent: #f2b134;
  --accent-text: #f2b134;
  --on-accent: #1b1300;
  --line: rgba(239, 234, 223, .12);
  --line-2: rgba(239, 234, 223, .24);
  --glass: rgba(7, 33, 26, .8);
  --display: "Lalezar", "Vazirmatn", Tahoma, sans-serif;
  --body: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  --hh: 68px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f1eee4;
  --bg-deep: #e5e0d1;
  --text: #0c2a21;
  --muted: #4d6a5d;
  --accent-text: #8a5400;
  --line: rgba(12, 42, 33, .14);
  --line-2: rgba(12, 42, 33, .3);
  --glass: rgba(241, 238, 228, .85);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--hh) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.05rem/1.95 var(--body);
  overflow-x: clip; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, dl, dd { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure { margin: 0; }
button { font-family: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.3; }
.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }

.i {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.skip {
  position: fixed; top: -80px; inset-inline-start: 16px; z-index: 200; padding: 10px 18px;
  background: var(--accent); color: var(--on-accent); border-radius: 10px; font-weight: 700;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.progress-bar {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 80; background: var(--accent);
  transform: scaleX(0); transform-origin: 100% 50%;
}
.site-header {
  position: fixed; top: 0; inset-inline: 0; height: var(--hh); z-index: 60;
  border-bottom: 1px solid transparent; transition: background .3s, border-color .3s;
}
.site-header.scrolled {
  background: var(--glass); border-bottom-color: var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font: 400 1.35rem/1 var(--display); }
.brand-mark { width: 16px; height: 22px; background: var(--accent); border-radius: 999px 999px 0 0; }
.nav { display: flex; gap: 2px; margin-inline: auto; }
.nav a { position: relative; padding: 6px 14px; color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.nav a[aria-current]::after {
  content: ""; position: absolute; inset-inline: 14px; bottom: 0; height: 2px; background: var(--accent);
}
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 12px; background: transparent; color: var(--text);
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.menu-btn { display: none; }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: inline-block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 26px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 700; font-size: .97rem; line-height: 1.4; cursor: pointer;
  transition: transform .25s var(--ease), border-color .2s, color .2s, background .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); transform: translateY(-2px); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding: calc(var(--hh) + 40px) 0 80px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: linear-gradient(180deg, #000 0, transparent 80%);
  mask-image: linear-gradient(180deg, #000 0, transparent 80%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: clamp(32px, 6vw, 80px); }
.hero h1 { font-size: clamp(3rem, 9vw, 6.6rem); line-height: 1.18; }
.lead { margin-top: 18px; font-size: clamp(1.15rem, 2.5vw, 1.5rem); color: var(--muted); max-width: 30ch; }
.role {
  margin-top: 26px; padding-inline-start: 16px; border-inline-start: 3px solid var(--accent);
  font-weight: 500; font-size: 1rem; max-width: 40ch;
}

/* محراب: قاب عکس */
.arch-wrap { position: relative; width: min(380px, 76vw); aspect-ratio: 3 / 4; margin-inline: auto; }
.arch { position: absolute; border: 1px solid var(--line-2); border-radius: 999px 999px 0 0; }
.a1 { inset: 0; overflow: hidden; border: 0; background: var(--bg-deep); }
.a1 img { width: 100%; height: 100%; object-fit: cover; }
.arch-placeholder { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 4.5rem; }
.a2 { inset: -16px -16px 0; transform-origin: 50% 100%; animation: breathe 8s ease-in-out infinite; }
.a3 { inset: -34px -34px 0; border-color: var(--accent); opacity: .7; transform-origin: 50% 100%; animation: breathe 8s ease-in-out -4s infinite; }
@keyframes breathe { 50% { transform: scale(1.035); } }
.arch-wrap::after {
  content: ""; position: absolute; bottom: 0; inset-inline: -56px; height: 1px; background: var(--line-2);
}

/* انیمیشن ورود: تنها حرکت خودکار صفحه */
.enter { animation: rise .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 120px) 0; border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.split { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.5fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.split > div > .muted { margin-top: 12px; max-width: 28ch; }
.section-head { margin-bottom: 52px; max-width: 560px; }
.section-head p { margin-top: 10px; color: var(--muted); }

/* About */
.about-body { display: grid; gap: 28px; justify-items: start; }
.prose p { margin-bottom: 1.1em; color: var(--muted); max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.facts { width: 100%; max-width: 520px; border-top: 1px solid var(--line-2); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 700; text-align: left; }

/* ---------- Slider ---------- */
.slider { position: relative; isolation: isolate; outline: none; }
.ambient {
  position: absolute; z-index: -1; top: -4%; left: 6%; width: 88%; height: 66%; object-fit: cover;
  filter: blur(70px) saturate(1.5); opacity: 0; transition: opacity 1.1s; pointer-events: none;
}
.ambient.on { opacity: .32; }
.slider-stage {
  position: relative; height: clamp(250px, 46vw, 480px); touch-action: pan-y; cursor: grab; user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.slide {
  position: absolute; top: 50%; left: 50%; width: 58%; height: calc(100% - 36px); z-index: 1;
  transform: translate(-50%, -50%) scale(.7); opacity: 0; pointer-events: none; filter: blur(4px) brightness(.6);
  transition: transform .7s var(--ease), opacity .7s, filter .7s;
}
.slide.is-active { transform: translate(-50%, -50%); opacity: 1; filter: none; z-index: 3; pointer-events: auto; }
.slide.is-prev { transform: translate(-50%, -50%) translateX(-74%) scale(.8); opacity: .85; z-index: 2; pointer-events: auto; cursor: pointer; }
.slide.is-next { transform: translate(-50%, -50%) translateX(74%) scale(.8); opacity: .85; z-index: 2; pointer-events: auto; cursor: pointer; }
.slide-card {
  position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 18px;
  border: 1px solid var(--line-2); background: var(--bg-deep); box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .7);
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease-out;
}
.slide-card img {
  width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none;
  transform: scale(1.05) translate(var(--px, 0px), var(--py, 0px)); transition: transform .25s ease-out;
}
.slide-cta {
  position: absolute; inset-inline: 0; bottom: 0; padding: 44px 22px 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; color: #fff; font-weight: 700; opacity: 0; transition: opacity .4s;
  background: linear-gradient(to top, rgba(0, 0, 0, .78), transparent);
}
.slide.is-active .slide-cta { opacity: 1; }

.slider-btn {
  position: absolute; top: 50%; z-index: 5; width: 46px; height: 46px; margin-top: -23px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--glass); color: var(--text); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .2s, color .2s, border-color .2s;
}
.slider-btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.slider-btn.prev { left: 4px; }
.slider-btn.next { right: 4px; }

.slider-meta { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.counter { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.counter b { color: var(--text); }
.progress { width: 140px; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.progress span.run { animation: fill linear forwards; }
@keyframes fill { to { transform: scaleX(1); } }
.slider.paused .progress span, .slider.is-off .progress span { animation-play-state: paused; }

.slider-info { max-width: 680px; margin: 30px auto 0; text-align: center; }
.js .slider-info .info { display: none; }
.js .slider-info .info.is-active { display: block; animation: rise .5s var(--ease) both; }
.info h3 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.info p { color: var(--muted); margin: 6px 0 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.info .tags { justify-content: center; }
.tags li { padding: 1px 14px; border: 1px solid var(--line-2); border-radius: 8px; font-size: .85rem; color: var(--muted); }
.slider.single .slider-btn, .slider.single .progress { display: none; }

/* ---------- Skills ---------- */
.skills-flow { display: flex; flex-wrap: wrap; font: 400 clamp(1.9rem, 4.8vw, 3.3rem)/1.5 var(--display); }
.skills-flow li { unicode-bidi: isolate; cursor: default; transition: color .2s; }
.skills-flow li:not(:last-child)::after { content: "/"; margin-inline: .4em; color: var(--accent); }
.skills-flow li:hover { color: var(--accent-text); }

/* ---------- Contact ---------- */
.ledger { border-top: 1px solid var(--line-2); }
.row { display: flex; border-bottom: 1px solid var(--line); transition: background .25s; }
.row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; padding: 20px 8px; }
.row-icon { color: var(--accent-text); font-size: 1.3rem; }
.row-label { flex: none; width: 88px; color: var(--muted); }
.row-value { flex: 1; min-width: 0; text-align: right; font-weight: 500; font-size: 1.1rem; overflow-wrap: anywhere; }
.row-go { color: var(--muted); transition: transform .3s var(--ease), color .2s; }
.row:hover .row-go { color: var(--accent-text); transform: translate(-4px, -4px); }
.copy-btn {
  flex: none; width: 58px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-inline-start: 1px solid var(--line); background: none; color: var(--muted); transition: color .2s;
}
.copy-btn:hover { color: var(--accent-text); }

/* ---------- Footer / toast ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 6px; }
.footer-links a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; transition: color .2s, background .2s; }
.footer-links a:hover { color: var(--accent-text); background: var(--line); }
.to-top:hover { color: var(--text); }
.toast {
  position: fixed; bottom: 26px; left: 50%; z-index: 120; padding: 10px 22px; border-radius: 12px; pointer-events: none;
  background: var(--accent); color: var(--on-accent); font-weight: 700; opacity: 0; transform: translate(-50%, 16px);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Project detail ---------- */
.detail { position: relative; isolation: isolate; padding: calc(var(--hh) + 48px) 0 100px; }
.detail-bg {
  position: absolute; z-index: -1; top: 0; left: 0; width: 100%; height: 480px; object-fit: cover;
  filter: blur(60px) saturate(1.4); opacity: .25; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent);
}
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 36px; color: var(--muted); transition: color .2s; }
.back-link:hover { color: var(--text); }
.detail-head h1 { font-size: clamp(2.8rem, 8vw, 5.4rem); line-height: 1.2; }
.detail-head .lead { max-width: 52ch; }
.detail-head .tags { margin: 22px 0 0; }
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin: 56px 0; }
.g-item { grid-column: span 2; }
.g-item:nth-child(5n + 2), .g-item:nth-child(5n + 3) { grid-column: span 3; }
.g-item.g-main { grid-column: 1 / -1; }
.g-item a { display: block; overflow: hidden; border-radius: 14px; border: 1px solid var(--line-2); }
.g-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .6s var(--ease); }
.g-main img { aspect-ratio: 16 / 9; }
.g-item a:hover img { transform: scale(1.04); }
.g-item figcaption { margin-top: 8px; color: var(--muted); font-size: .88rem; }
.detail-body { max-width: 760px; }
.detail-body h2 { font-size: 2rem; margin-bottom: 14px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; margin-top: 80px; border-top: 1px solid var(--line-2); }
.pn a { display: flex; align-items: center; gap: 16px; padding: 22px 8px; border-bottom: 1px solid var(--line); transition: background .25s; }
.pn a:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pn img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.pn small { display: block; color: var(--muted); font-size: .8rem; }
.pn b { font: 400 1.3rem/1.4 var(--display); }
.pn-next { grid-column: 2; justify-content: flex-end; text-align: left; }
.pn-prev { grid-column: 1; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(2, 10, 7, .92); }
.lb.open { display: flex; animation: rise .25s ease both; }
.lb img { max-height: 84vh; border-radius: 12px; }
.lb button {
  position: absolute; width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; transition: background .2s, color .2s;
}
.lb button:hover { background: var(--accent); color: var(--on-accent); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; margin-top: -23px; }
.lb-next { right: 18px; top: 50%; margin-top: -23px; }
.lb-count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; font-variant-numeric: tabular-nums; direction: ltr; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav {
    position: absolute; top: var(--hh); inset-inline: 0; margin: 0; padding: 10px 20px 18px; flex-direction: column;
    display: none; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a[aria-current]::after { inset-inline: 0; }
  .hero { min-height: auto; }
  .hero-grid { grid-template-columns: 1fr; }
  .arch-wrap { order: -1; width: min(300px, 70vw); margin-bottom: 36px; }
  .split { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .g-item, .g-item:nth-child(5n + 2), .g-item:nth-child(5n + 3) { grid-column: span 1; }
  .pn { grid-template-columns: 1fr; }
  .pn-prev, .pn-next { grid-column: 1; justify-content: flex-start; text-align: start; }
}
@media (max-width: 560px) {
  .brand-name { display: none; }
  .slide { width: 74%; }
  .slide.is-prev { transform: translate(-50%, -50%) translateX(-68%) scale(.8); }
  .slide.is-next { transform: translate(-50%, -50%) translateX(68%) scale(.8); }
  .slider-btn { width: 38px; height: 38px; margin-top: -19px; }
  .gallery { grid-template-columns: 1fr; }
  .row-label { width: 70px; }
  .arch-wrap::after { inset-inline: -20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
