/* imansaraei.com redesign draft: the inventor's notebook.
   Fonts: Newsreader (Iman's voice), DM Sans (visitor's replies, body), IBM Plex Mono ("what I built" notes). */

@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* ---------- Day: the coach's paper notebook ---------- */
:root {
  --bg: #F6F1E7;
  --text: #2B2A27;
  --muted: #6B665C;
  --grid: #E6DDCB;
  --accent: #C0583A;      /* fills, borders, large type */
  --accent-ink: #A84A2F;  /* small accent text and button fills: #C0583A is 3.97:1 on paper, this is 5.06:1 */
  --on-accent: #FFFFFF;
  --surface: color-mix(in srgb, var(--bg) 70%, #FFFFFF);
  --glow: none;
  --serif: "Newsreader", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --measure: 40rem;
  color-scheme: light;
}

/* ---------- Night: the workshop after hours ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12233F; --text: #EDEAE2; --muted: #9FB0C8; --grid: #2A4570;
    --accent: #E58A6A; --accent-ink: #E58A6A; --on-accent: #12233F;
    --surface: color-mix(in srgb, var(--bg) 82%, #FFFFFF);
    --glow: 0 0 18px color-mix(in srgb, #E58A6A 45%, transparent);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12233F; --text: #EDEAE2; --muted: #9FB0C8; --grid: #2A4570;
  --accent: #E58A6A; --accent-ink: #E58A6A; --on-accent: #12233F;
  --surface: color-mix(in srgb, var(--bg) 82%, #FFFFFF);
  --glow: 0 0 18px color-mix(in srgb, #E58A6A 45%, transparent);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0; color: var(--text); font: 400 1.0625rem/1.6 var(--sans); overflow-x: clip;
  background-color: var(--bg);
  /* Engineering-paper grid */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2 { margin: 0; font-weight: 500; }
p { margin: 0; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--accent-ink); color: var(--on-accent); padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 1rem; }

/* ---------- Top bar: Iman small in a corner ---------- */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; row-gap: .5rem;
  padding: .75rem clamp(1rem, 4vw, 2rem); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.me {
  display: flex; align-items: center; gap: .65rem; padding: .25rem .75rem .25rem .25rem; border: 1px solid transparent;
  border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: .9rem; text-align: start; cursor: pointer;
  text-decoration: none;
}
.me:hover { border-color: var(--grid); }
.me img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.me strong { color: var(--text); font-weight: 600; }
.tabs { display: flex; align-items: center; gap: .15rem; }
/* Quiet text tabs: the current page is charcoal and underlined. Terracotta stays for "this part helps you". */
.tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: .4rem .7rem; color: var(--muted);
  font-size: .92rem; font-weight: 500; white-space: nowrap; text-decoration: none; text-underline-offset: .45em;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; }
.bar__tools { display: flex; align-items: center; gap: .5rem; }
.lang { font-family: Vazirmatn, Tahoma, sans-serif; font-size: .95rem; text-decoration: none; color: var(--muted); padding: .4rem .6rem; min-height: 44px; display: inline-flex; align-items: center; }
.lang:hover { color: var(--text); }
.theme { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--grid); background: var(--surface); color: var(--text); cursor: pointer; }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .i-moon { fill: currentColor; stroke: none; display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-arabic.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Vazir Code"; src: url("../fonts/vazir-code.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* ---------- Persian page: Vazirmatn carries both voices; weight and size tell them apart ---------- */
:root[lang="fa"] { --serif: "Vazirmatn", Tahoma, sans-serif; --sans: "Vazirmatn", Tahoma, sans-serif; --mono: "Vazir Code", "Vazirmatn", ui-monospace, monospace; }
/* Plex Mono has no Persian letters, so the builder layer uses Vazir Code (a Persian monospace) here. */
:root[lang="fa"] body { line-height: 1.9; }
:root[lang="fa"] .ask, :root[lang="fa"] .page__title { font-weight: 700; line-height: 1.35; letter-spacing: 0; }
:root[lang="fa"] .iman, :root[lang="fa"] .page__lead { font-weight: 300; line-height: 1.8; }
:root[lang="fa"] h2.iman { font-weight: 600; }
:root[lang="fa"] :is(.demo__label, .built__label, .card-link__meta, .split thead th, .overlap thead th) { text-transform: none; letter-spacing: 0; font-family: var(--sans); }
:root[lang="fa"] .note { font-family: var(--sans); }

/* ---------- First screen ---------- */
main { width: min(100% - 2rem, var(--measure)); margin-inline: auto; padding-block-end: 4rem; }
.start { min-height: calc(100svh - 4.5rem); display: grid; align-content: center; gap: 2rem; padding-block: 2rem 3rem; }
.ask { font: 500 clamp(2.2rem, 7vw, 3.4rem)/1.1 var(--serif); letter-spacing: -.01em; text-align: center; text-wrap: balance; }
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.option {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.2rem; border: 1px solid var(--grid); border-radius: 14px; background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 500; transition: border-color .2s, box-shadow .2s;
}
.option:hover, .option[aria-current="true"] { border-color: var(--accent); box-shadow: var(--glow); }
.option::after { content: "→"; flex: none; color: var(--accent-ink); }
:root[dir="rtl"] .option::after { content: "←"; }
.option--quiet { background: transparent; border-style: dashed; color: var(--muted); }
.note { font: .85rem/1.5 var(--mono); color: var(--muted); text-align: center; }

/* ---------- The problem path: a dialogue ---------- */
.path { padding-block: 2.5rem 1rem; display: grid; gap: 1.75rem; border-block-start: 1px dashed var(--grid); }
.step { display: grid; gap: 1rem; }
.iman { font: 400 clamp(1.3rem, 3.2vw, 1.55rem)/1.45 var(--serif); max-width: 34ch; }
h2.iman { font-weight: 500; }
.you {
  justify-self: end; max-width: 85%; padding: .6rem 1rem; border-radius: 16px; border-end-end-radius: 4px;
  background: var(--accent-ink); color: var(--on-accent); font-weight: 500;
}
.reply {
  justify-self: end; display: inline-block; padding: .65rem 1.1rem; border: 1.5px solid var(--accent); border-radius: 999px;
  background: transparent; color: var(--text); font: 500 1rem var(--sans); text-decoration: none; cursor: pointer; text-align: start;
}
.reply:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: var(--glow); }
.reply--quiet { border-color: var(--grid); color: var(--muted); }
.exit__links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }

/* Quick-win demos: the accent means "this part helps you" */
.demo { border: 1.5px solid var(--accent); border-radius: 16px; padding: 1.1rem 1.2rem; display: grid; gap: .9rem; background: var(--surface); box-shadow: var(--glow); }
.demo__label { font: .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); }
.demo__out { color: var(--muted); }
.demo__out strong { color: var(--text); }
.demo__out--big { font: 400 1.25rem/1.4 var(--serif); color: var(--text); }
.btn {
  justify-self: start; display: inline-block; padding: .6rem 1.1rem; border: 0; border-radius: 10px; background: var(--accent-ink);
  color: var(--on-accent); font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--link { margin-block-start: .25rem; }
.fields { display: grid; gap: .75rem; }
.fields label, .tell label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--muted); border-radius: 8px; padding: .5rem .65rem;
}
input[type="checkbox"] { width: 1.5rem; height: 1.5rem; accent-color: var(--accent-ink); }
.chores { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.chores li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.chores label { display: flex; align-items: center; gap: .6rem; }
.chores__state { font: .8rem var(--mono); color: var(--muted); }
.split, .overlap { width: 100%; border-collapse: collapse; font-size: .95rem; }
.split th, .split td, .overlap th, .overlap td { padding: .35rem .25rem; text-align: start; border-block-end: 1px solid var(--grid); }
.split thead th, .overlap thead th { font: .72rem var(--mono); text-transform: uppercase; color: var(--muted); font-weight: 400; }
.split input { width: 4.5rem; }
.overlap td { text-align: center; }
.bar-split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--grid); }
.bar-split span:first-child { background: var(--accent); }
.bar-split span:last-child { background: var(--muted); }
.recap { margin: 0; white-space: pre-wrap; font: .9rem/1.5 var(--mono); padding: .75rem; border: 1px dashed var(--grid); border-radius: 8px; min-height: 4.5rem; }

/* The builder layer: "what I built" notes */
.built { border: 1px solid var(--grid); border-radius: 4px; padding: 1.1rem; display: grid; gap: .8rem; font: .92rem/1.6 var(--mono); background: var(--surface); position: relative; }
.built__label { font: .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.built__label::before { content: "↳ "; color: var(--accent-ink); }
.built img { width: min(100%, 220px); justify-self: center; border-radius: 18px; border: 1px solid var(--grid); }

/* Story video: click-to-load placeholder, nothing loads until a video exists and is clicked */
.video {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border: 1px dashed var(--muted); border-radius: 14px;
  background: transparent; color: var(--text); font: 500 1rem var(--sans); cursor: pointer; text-align: start;
}
.video em { color: var(--muted); font-style: normal; font-weight: 400; }
.video__play { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1.5px solid var(--accent); position: relative; }
/* Play icons point right in both directions, so this one uses physical sides. */
.video__play::after { content: ""; position: absolute; left: 1rem; top: .75rem; border-block: .55rem solid transparent; border-left: .85rem solid var(--accent); }

/* Drafting notes: visible on purpose until the content is written */
.draft { font: .8rem/1.5 var(--mono); color: var(--accent-ink); border-inline-start: 2px solid var(--accent); padding-inline-start: .6rem; }

/* "I couldn't find my problem" */
.approved { display: grid; gap: .75rem; padding: 1rem 1.1rem; border-inline-start: 3px solid var(--accent); background: var(--surface); border-start-end-radius: 12px; border-end-end-radius: 12px; }
.tell { display: grid; gap: .9rem; }
.optional { font-size: .8rem; }

/* About Iman */
.about { width: min(100% - 2rem, 28rem); border: 1px solid var(--grid); border-radius: 18px; padding: 1.5rem; background: var(--bg); color: var(--text); }
.about::backdrop { background: rgb(0 0 0 / .45); }
.about > * + * { margin-block-start: .9rem; }
.about img { width: 120px; height: 150px; object-fit: cover; border-radius: 14px; border: 2px solid var(--accent); }
.about h2 { font: 500 1.8rem var(--serif); }
.about__close { float: inline-end; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--grid); background: none; color: var(--text); font-size: 1.3rem; cursor: pointer; }
.about .note { text-align: start; }

.foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1rem, 4vw, 2rem); color: var(--muted); font: .8rem var(--mono); }

/* ---------- Subpages (Who am I?, Mind Games, My thoughts, My Playlist) ---------- */
.page { padding-block: 2.5rem 4rem; display: grid; gap: 2rem; }
.page__head { display: grid; gap: .85rem; }
.page__title { font: 500 clamp(2rem, 6vw, 3rem)/1.15 var(--serif); letter-spacing: -.01em; }
.page__lead { font: 400 clamp(1.15rem, 2.8vw, 1.35rem)/1.55 var(--serif); color: var(--muted); max-width: 44ch; }
.page__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.card-link {
  display: grid; gap: .6rem; padding: 1.25rem 1.35rem; border: 1px solid var(--grid); border-radius: 16px;
  background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .2s, box-shadow .2s;
}
.card-link:hover { border-color: var(--accent); box-shadow: var(--glow); }
.card-link__meta { font: .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card-link__title { font: 500 1.4rem/1.3 var(--serif); color: var(--text); }
.card-link__desc { color: var(--muted); line-height: 1.6; }
.card-link__cta { font: 600 .92rem var(--sans); color: var(--accent-ink); }
.who { display: grid; gap: 1.25rem; }
.who__photo { width: 132px; height: 165px; object-fit: cover; border-radius: 16px; border: 2px solid var(--accent); }
.who__links { display: flex; flex-wrap: wrap; gap: .65rem; }
.empty-note {
  padding: 1.25rem 1.35rem; border: 1px dashed var(--grid); border-radius: 16px;
  background: var(--surface); color: var(--muted); display: grid; gap: .6rem;
}

/* ---------- Behaviour with JS: one path at a time, steps arrive one by one ---------- */
.js .path { display: none; }
.js .path.is-open { display: grid; }
.js .step:not(.is-shown) { display: none; }

/* The one animation: a new step arriving */
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } }
.arrive { animation: arrive .45s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .arrive { animation: none; }
}

/* Laptops and tablets: drop the photo's short line so photo, tabs and tools fit on one row. */
@media (max-width: 1100px) {
  .me span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .me { padding: .25rem; }
}
/* Phones: every tab stays visible on its own row, and the bar scrolls away instead of covering the page. */
@media (max-width: 820px) {
  .bar { position: static; }
  .tabs { order: 3; flex-basis: 100%; flex-wrap: wrap; justify-content: center; }
  .tabs a { padding-inline: .55rem; }
}

@media (max-width: 520px) {
  .me span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .me { padding: .25rem; }
  .iman { max-width: none; }
}
