/* Malek Norouzi: personal site
   Fonts are self-hosted so the site does not depend on Google or any CDN
   (those can be slow or blocked for visitors in Iran). */

@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f8f5ef;
  --paper-2: #efe9de;
  --card: #fffdf9;
  --ink: #1e2a30;
  --ink-2: #4a5a62;
  --ink-3: #75848b;
  --line: #ddd5c6;
  --deep: #1d3b4a;        /* mountain slate from the cover */
  --deep-2: #2c5468;
  --lake: #5f7f73;
  --earth: #8a4a32;       /* red-brown hillside from the cover */
  --sky: #d7e2ea;
  --ok: #2f6b4f;
  --err: #9a3b2b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 42, 48, .06), 0 8px 24px rgba(30, 42, 48, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191d;
    --paper-2: #182227;
    --card: #1b262c;
    --ink: #e9e5dc;
    --ink-2: #b7bfc2;
    --ink-3: #8b979c;
    --line: #2c3a41;
    --deep: #9cc1d3;
    --deep-2: #b9d4e1;
    --lake: #8fb1a4;
    --earth: #d99a7c;
    --sky: #22313a;
    --ok: #7cc3a0;
    --err: #e59a86;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.9;
  text-rendering: optimizeLegibility;
}
html[lang="en"] body { line-height: 1.7; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--deep-2); text-underline-offset: 3px; }
a:hover { color: var(--earth); }

.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 60px;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: 0; }
.nav { display: flex; gap: 6px 18px; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.nav .lang {
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px;
  font-size: .85rem; color: var(--ink-2);
}
@media (max-width: 560px) {
  .nav a:not(.lang) { display: none; }
}

/* ---------- hero (home) ---------- */
.hero {
  position: relative;
  padding: 72px 0 56px;
  background:
    linear-gradient(to bottom, var(--sky), var(--paper) 85%);
  overflow: hidden;
}
.hero .wrap { display: grid; grid-template-columns: 1.3fr .7fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.25; margin: 0 0 12px; color: var(--deep); }
.hero .lede { font-size: 1.15rem; color: var(--ink-2); margin: 0 0 28px; max-width: 34em; }
.hero .cover-link { justify-self: center; }
.hero .cover-link img { width: 230px; border-radius: 4px; box-shadow: 0 18px 40px rgba(29,59,74,.28); transform: rotate(-1.5deg); transition: transform .3s; }
html[dir="ltr"] .hero .cover-link img { transform: rotate(1.5deg); }
.hero .cover-link:hover img { transform: rotate(0); }
@media (max-width: 760px) {
  .hero { padding: 44px 0 36px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .hero .cover-link img { width: 180px; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px;
  font: inherit; font-weight: 500; font-size: .98rem; line-height: 1.5;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--deep); color: var(--paper); }
.btn-primary:hover { background: var(--deep-2); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--deep); border-color: color-mix(in srgb, var(--deep) 35%, transparent); }
.btn-ghost:hover { border-color: var(--deep); color: var(--deep); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- sections ---------- */
section.block { padding: 56px 0; }
section.block + section.block { border-top: 1px solid var(--line); }
.eyebrow { color: var(--earth); font-weight: 500; font-size: .9rem; margin: 0 0 4px; letter-spacing: .02em; }
h2 { font-size: 1.6rem; line-height: 1.4; margin: 0 0 20px; color: var(--deep); }
h3 { font-size: 1.15rem; line-height: 1.5; margin: 0 0 8px; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-3); }
.small { font-size: .9rem; }
.prose { max-width: 42em; }
.prose p { text-align: justify; }
html[lang="en"] .prose p { text-align: start; }
@media (max-width: 560px) { .prose p { text-align: start; } }

/* ---------- works grid ---------- */
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.work {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; display: grid; grid-template-columns: 96px 1fr; gap: 18px;
  align-items: start;
}
.work .thumb { width: 96px; border-radius: 3px; box-shadow: 0 6px 14px rgba(29,59,74,.22); }
.work .thumb-placeholder {
  width: 96px; aspect-ratio: 1414 / 2000; border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--paper-2) 0 10px, var(--paper) 10px 20px);
  border: 1px dashed var(--line); display: grid; place-items: center; color: var(--ink-3); font-size: .8rem; text-align: center; padding: 6px;
}
.work .kind { display: inline-block; font-size: .78rem; color: var(--lake); border: 1px solid color-mix(in srgb, var(--lake) 45%, transparent); border-radius: 999px; padding: 0 10px; margin-bottom: 6px; }
.work h3 a { color: var(--ink); text-decoration: none; }
.work h3 a:hover { color: var(--earth); }
.work p { color: var(--ink-2); font-size: .95rem; margin-bottom: 12px; }
.work audio { width: 100%; margin-top: 4px; }
.work.audio { grid-template-columns: 1fr; }

/* ---------- book page ---------- */
.book-hero { padding: 56px 0 40px; background: linear-gradient(to bottom, var(--sky), var(--paper) 90%); }
.book-hero .wrap { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: start; }
.book-hero .cover { width: 280px; border-radius: 4px; box-shadow: 0 22px 48px rgba(29,59,74,.3); }
.book-hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.3; margin: 0 0 4px; color: var(--deep); }
.book-hero .subtitle { font-size: 1.15rem; color: var(--ink-2); margin: 0 0 4px; }
.book-hero .author { font-size: 1.1rem; color: var(--ink-2); margin: 0 0 20px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; margin: 0 0 24px; font-size: .93rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); }
.ltr-num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
@media (max-width: 760px) {
  .book-hero .wrap { grid-template-columns: 1fr; gap: 24px; }
  .book-hero .cover { width: 200px; }
}

.toc { columns: 2 260px; column-gap: 32px; padding: 0; margin: 0; list-style: none; counter-reset: c; }
.toc li { break-inside: avoid; padding: 6px 0; border-bottom: 1px dotted var(--line); color: var(--ink-2); font-size: .95rem; }

.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 8px; aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.gallery figcaption { font-size: .88rem; color: var(--ink-3); margin-top: 6px; }
@media (max-width: 760px) { .gallery { grid-template-columns: 1fr 1fr; } }

/* ---------- request + gift panels ---------- */
.panels { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .panels { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.panel h2 { font-size: 1.35rem; margin-bottom: 8px; }
.panel.gift { background: color-mix(in srgb, var(--card) 85%, var(--sky)); }

form .field { margin-bottom: 16px; }
form label.lbl { display: block; font-weight: 500; font-size: .95rem; margin-bottom: 4px; }
form .opt { color: var(--ink-3); font-weight: 400; font-size: .85rem; }
input[type=text], input[type=email], textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type=email] { direction: ltr; text-align: start; }
html[dir="rtl"] input[type=email] { text-align: right; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--deep) 50%, transparent); outline-offset: 1px; border-color: var(--deep); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: .93rem; background: var(--paper);
}
.choices input { accent-color: var(--deep); margin: 0; }
.choices label:has(input:checked) { border-color: var(--deep); background: color-mix(in srgb, var(--sky) 60%, var(--paper)); }
.hint { font-size: .85rem; color: var(--ink-3); margin-top: 4px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.status { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: .95rem; display: none; }
.status.show { display: block; }
.status.ok { background: color-mix(in srgb, var(--ok) 12%, var(--card)); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.status.err { background: color-mix(in srgb, var(--err) 10%, var(--card)); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); }

.fallback { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: .92rem; color: var(--ink-2); }
.fallback a { font-weight: 500; }
.email-text { direction: ltr; unicode-bidi: isolate; }

.amounts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.amounts .btn { padding: 8px 18px; }
.pay-alt { margin-top: 16px; display: grid; gap: 8px; font-size: .93rem; }
.pay-alt .row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pay-alt .k { color: var(--ink-3); min-width: 4.5em; }
.pay-alt code { font-family: inherit; direction: ltr; unicode-bidi: isolate; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.copy { font: inherit; font-size: .8rem; color: var(--deep-2); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }

.hidden { display: none !important; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer a { color: var(--ink-3); }

/* ---------- profile (landing page) ---------- */
.profile {
  padding: 64px 0 48px;
  background: linear-gradient(to bottom, var(--sky), var(--paper) 90%);
}
.profile .wrap { display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: start; }
.headshot {
  width: 220px; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 50%; border: 6px solid var(--card);
  box-shadow: 0 14px 34px rgba(29,59,74,.22);
}
.profile h1 { font-size: clamp(2.1rem, 5.5vw, 3rem); line-height: 1.25; margin: 6px 0 2px; color: var(--deep); }
.profile .role { color: var(--earth); font-weight: 500; margin: 0; }
.profile .place { color: var(--ink-3); font-size: .95rem; margin: 0 0 18px; }
.profile .bio p { color: var(--ink); }
@media (max-width: 760px) {
  .profile { padding: 40px 0 28px; }
  .profile .wrap { grid-template-columns: 1fr; gap: 20px; }
  .headshot { width: 150px; }
}

#works h2, #contact h2 { margin-bottom: 18px; }
a.work-link { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.work-link:hover { border-color: color-mix(in srgb, var(--deep) 40%, var(--line)); transform: translateY(-2px); }
a.work-link h3 { color: var(--ink); }
a.work-link:hover h3 { color: var(--earth); }
.work .more { font-size: .92rem; font-weight: 500; color: var(--deep-2); }
@media (min-width: 900px) {
  .works { grid-template-columns: repeat(2, 1fr); }
}

/* note under gift options */
.gift-note { font-size: .85rem; color: var(--ink-3); margin-top: 14px; }

/* PayPal account line */
.paypal-line { margin: 10px 0 4px; font-size: .98rem; }
.paypal-line .k { color: var(--ink-2); font-weight: 500; }
a.paypal-link { direction: ltr; unicode-bidi: isolate; font-weight: 500; }
