/* ============================================================
   Mojtaba — resume site
   Motif: a waveform that reads as both audio signal and data.
   Palette: deep indigo/charcoal + warm brass (Persian craft).
   ============================================================ */

/* ---- Design tokens ---- */
:root {
  --brass: #d8a657;
  --brass-deep: #b8893f;
  --indigo: #6d8ad1;

  /* Dark (default) */
  --bg: #0e1116;
  --bg-elev: #161b23;
  --bg-card: #1a212b;
  --text: #e8ecf2;
  --text-dim: #9aa6b6;
  --border: #2a3340;
  --accent: var(--brass);
  --accent-2: var(--indigo);
  /* Accent for small text that must clear WCAG AA. On the dark background the
     brass already measures 8.6:1, so it is the same colour here. */
  --accent-text: var(--brass);
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --maxw: 1080px;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: 240ms cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --text: #1b2330;
  --text-dim: #5a6675;
  --border: #e2dccf;
  --accent: var(--brass-deep);
  --accent-2: #3f5aa6;
  /* --brass-deep is only 2.9:1 on this background — too low for text. This is
     the same hue taken darker, at 4.9:1. */
  --accent-text: #8f6220;
  --shadow: 0 10px 30px rgba(40,40,60,.12);
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
a { color: inherit; }
img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #1b2330; padding: .6rem 1rem; border-radius: 0 0 8px 0;
  z-index: 100; font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* ---- Header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; text-decoration: none; color: var(--text); }
.brand__mark { color: var(--accent); }
.nav__menu {
  list-style: none; display: flex; align-items: center; gap: 1.4rem; margin: 0; padding: 0;
}
.nav__menu a { text-decoration: none; color: var(--text-dim); font-size: .95rem; transition: color var(--transition); }
.nav__menu a:hover { color: var(--accent); }

.nav__toggle { display: none; background: none; border: 0; cursor: pointer; padding: .4rem; }
.nav__toggle span { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; transition: var(--transition); }

.theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; }
.theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: block; }

/* ---- Hero ---- */
.hero {
  position: relative; overflow: hidden;
  min-height: clamp(560px, 88vh, 820px);
  display: grid; align-items: center;
  padding: 2rem var(--pad) 4rem;
}
.hero__inner { max-width: var(--maxw); margin: 0 auto; width: 100%; position: relative; z-index: 2; }
.hero__wave {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: .5;
}
.wave-line { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .35;
  stroke-dasharray: 6 10; animation: drift 14s linear infinite; }
.wave-line--2 { stroke: var(--accent-2); opacity: .25; animation-duration: 20s; }
@keyframes drift { to { stroke-dashoffset: -320; } }

.hero__eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; margin: 0 0 .8rem; }
.hero__title { font-size: clamp(3rem, 11vw, 6.5rem); margin: 0 0 .3rem; }
.hero__tagline { font-size: clamp(1.2rem, 3.2vw, 1.8rem); max-width: 42ch; margin: 0 0 1rem; color: var(--text); }
.hero__tagline .accent { color: var(--accent); font-style: italic; }
.hero__intro { color: var(--text-dim); max-width: 56ch; margin: 0 0 2rem; }

.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; }

.hero__scroll {
  position: absolute; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--text-dim); border-radius: 14px; z-index: 2;
}
.hero__scroll span { position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  background: var(--accent); border-radius: 2px; animation: scroll 1.8s ease infinite; }
@keyframes scroll { 0%{opacity:0;transform:translateY(0)} 40%{opacity:1} 100%{opacity:0;transform:translateY(14px)} }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.3rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: .95rem;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn--primary { background: var(--accent); color: #1b1305; border-color: var(--accent); }
.btn--primary:hover { background: var(--brass-deep); }

/* ---- Sections ---- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(3.5rem, 9vw, 6rem) var(--pad); }
.section__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2rem; }
.section__index { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1rem; }
.section__head h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0; position: relative; }
.section__head h2::after {
  content: ""; display: block; width: 56px; height: 3px; margin-top: .5rem;
  background: linear-gradient(90deg, var(--accent), transparent); border-radius: 2px;
}
.lead { font-size: 1.15rem; max-width: 62ch; }
.about p { max-width: 64ch; }
.subhead { margin: 2.4rem 0 1rem; font-size: 1.1rem; color: var(--accent); }
.role { font-size: 1.15rem; }
.role__meta { color: var(--text-dim); }

/* ---- Chips ---- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; padding: 0; margin: 0; }
.chips li { padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); font-size: .9rem; font-weight: 500; }

/* ---- Cards ---- */
.cards { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h4 { margin: 0 0 .5rem; font-size: 1.1rem; }
.card p { margin: 0 0 .8rem; color: var(--text-dim); }
.tags, .instrument__level { margin: 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; }
.tags li { font-size: .78rem; color: var(--accent); border: 1px solid var(--border); border-radius: 6px; padding: .15rem .5rem; }
.card--instrument h4 { color: var(--accent); }
.instrument__level { font-weight: 600; color: var(--text); margin-bottom: .5rem; font-size: .9rem; }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 1.6rem 2rem; display: grid; gap: .15rem; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.timeline__year { color: var(--accent); font-size: .85rem; font-weight: 600; }
.timeline__title { font-weight: 700; }
.timeline__desc { color: var(--text-dim); font-size: .92rem; }

/* ---- Highlights ---- */
.highlights { padding-left: 1.1rem; color: var(--text-dim); }
.highlights li { margin-bottom: .4rem; }

/* ---- Music section accent ---- */
.section--music { position: relative; }

/* ---- Embed ---- */
.embed { border: 1px dashed var(--border); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; display: grid; }
.embed iframe { width: 100%; height: 100%; border: 0; }
.embed__placeholder { place-self: center; text-align: center; color: var(--text-dim); padding: 1.5rem; margin: 0; }
.embed code { background: var(--bg-elev); padding: .1rem .4rem; border-radius: 4px; color: var(--accent); }

/* ---- Blog teaser (list filled from /blog/feed.json by script.js) ---- */
.writing__list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.writing__list:empty { display: none; }
.writing__item { padding: 1.1rem 0; border-bottom: 1px solid var(--border); }
.writing__item:last-child { border-bottom: 0; }
.writing__meta { margin: 0 0 .3rem; font-size: .8rem; color: var(--text-dim); }
.writing__type { color: var(--accent-text); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; }
.writing__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 .3rem; line-height: 1.3; }
.writing__title a { text-decoration: none; }
.writing__title a:hover { color: var(--accent-text); }
.writing__desc { margin: 0; color: var(--text-dim); font-size: .95rem; max-width: 62ch; }
.writing__cta { margin-top: 1.75rem; }

/* ---- Contact ---- */
.section--contact { text-align: center; }
.section--contact .section__head { justify-content: center; }
.section--contact .section__head h2::after { margin-left: auto; margin-right: auto; }
.contact__links { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.5rem; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 2rem var(--pad); color: var(--text-dim); font-size: .9rem; }

/* ---- Placeholder marker ---- */
.placeholder { color: var(--accent-2); font-style: italic; font-weight: 500; }
[data-theme="dark"] .placeholder { opacity: .85; }

/* ---- Reveal on scroll ---- */
.section, .hero__inner > * { }
[data-animate] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
[data-animate].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-animate] { opacity: 1; transform: none; } }

/* ---- Responsive nav ---- */
@media (max-width: 720px) {
  .nav__toggle { display: block; }
  .nav__menu {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 1rem;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 1.2rem var(--pad); transform: translateY(-120%); transition: transform var(--transition);
    box-shadow: var(--shadow);
  }
  .nav__menu.is-open { transform: translateY(0); }
  .nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
  .nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
