/* ─────────────────────────────────────────────────────────────
   Mojtaba Alehosseini — v2
   Quiet light theme, soft dark mirror. One font. Single sage accent.
   See DESIGN_DECISIONS.md for why every value is what it is.
   ───────────────────────────────────────────────────────────── */

/* TOKENS — LIGHT (default) */
:root {
  --bg:          #F8F5EE;
  --surface:    #FFFFFF;
  --text:       #1A1A1A;
  --text-soft:  #3D3D3D;
  --muted:      #6B6B6B;
  --rule:       #DCD8CE;
  --accent:     #6B8E5B;
  --accent-h:   #557249;
  --selection-bg: #DDE6D2;

  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --max:    44rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);

  --t:      180ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* TOKENS — DARK */
:root[data-theme="dark"] {
  --bg:          #14161A;
  --surface:    #1B1E23;
  --text:       #EAE8E2;
  --text-soft:  #C4C2BD;
  --muted:      #8A8D92;
  --rule:       #2A2D34;
  --accent:     #8FAE7C;
  --accent-h:   #A6C394;
  --selection-bg: #2B3825;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color var(--t), color var(--t);
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  transition: color var(--t);
}
img, svg { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

::selection { background: var(--selection-bg); color: var(--text); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 5px; border: 2px solid var(--bg); }

/* SKIP */
.skip {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--surface);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  z-index: 100;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

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

/* LINKS */
.link {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  transition: color var(--t), border-color var(--t);
}
.link:hover, .link:focus-visible {
  color: var(--accent-h);
  outline: none;
}
.link--quiet {
  color: var(--muted);
  border-bottom-color: var(--rule);
}
.link--quiet:hover { color: var(--text); border-bottom-color: var(--text); }

.dim { color: var(--muted); }

/* TOP BAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.brand {
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  transition: color var(--t);
}
.brand:hover { color: var(--accent); }

.nav {
  display: none;
  gap: 0.55rem;
  font-size: 0.94rem;
  color: var(--muted);
}
.nav a {
  transition: color var(--t);
}
.nav a:hover, .nav a:focus-visible { color: var(--accent); outline: none; }
@media (min-width: 720px) { .nav { display: inline-flex; align-items: center; } }

.toggle {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text);
  transition: background var(--t), color var(--t);
}
.toggle:hover { background: var(--rule); color: var(--accent); }
.toggle__sun { display: none; }
.toggle__moon { display: block; }
:root[data-theme="dark"] .toggle__sun { display: block; }
:root[data-theme="dark"] .toggle__moon { display: none; }

/* MAIN COLUMN */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem var(--gutter) 1rem;
}

/* HERO */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem 0 3rem;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 600px) {
  .hero {
    grid-template-columns: 9.5rem 1fr;
    gap: 2rem;
  }
}
.hero__photo {
  margin: 0;
  width: 9.5rem;
  max-width: 60%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--rule);
}
.hero__photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.92);
  transition: filter var(--t);
}
.hero__text h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.15rem);
  font-weight: 500;
  margin: 0.1rem 0 0.6rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.hero__tag {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 36ch;
  margin: 0 0 1rem;
  line-height: 1.5;
}
.hero__loc {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}

/* BLOCKS */
.block {
  padding: 3rem 0;
  border-bottom: 1px solid var(--rule);
}
.block:last-of-type { border-bottom: 0; }
.block h2 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 1.3rem;
}
.block h2 .dim { font-weight: 400; }
.block p {
  margin: 0 0 1rem;
  max-width: 60ch;
  color: var(--text);
}
.block p:last-child { margin-bottom: 0; }
.block__lede {
  color: var(--text-soft) !important;
}
.block__foot {
  margin-top: 1.5rem !important;
  font-size: 0.95rem;
}

/* NOW LIST */
.now {
  display: grid;
  gap: 0.65rem;
  max-width: 60ch;
}
.now li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.35rem 0;
}
.now__key {
  color: var(--muted);
  font-size: 0.88rem;
}
.now__val { color: var(--text); }
.now em { font-style: italic; }
@media (max-width: 540px) {
  .now li { grid-template-columns: 1fr; gap: 0.1rem; }
  .now__key { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
}

/* TIMELINE (Work) */
.timeline {
  display: grid;
  gap: 1.75rem;
}
.timeline > li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
}
.timeline__when {
  font-size: 0.82rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.timeline__what {
  font-size: 1.02rem;
  font-weight: 500;
  margin: 0.1rem 0 0.1rem;
  letter-spacing: -0.005em;
  color: var(--text);
}
.timeline__where {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}
.timeline > li p {
  font-size: 0.98rem;
  color: var(--text-soft);
  margin: 0;
  max-width: 60ch;
  line-height: 1.55;
}

/* PROJECTS / REPOS */
.repos {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule);
}
.repo {
  border-bottom: 1px solid var(--rule);
  transition: background var(--t);
}
.repo:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.repo__link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  padding: 0.9rem 0.25rem;
  align-items: baseline;
}
.repo__main {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}
.repo__name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition: color var(--t);
}
.repo__name::after {
  content: "→";
  color: var(--muted);
  font-size: 0.95em;
  transition: transform var(--t), color var(--t);
}
.repo:hover .repo__name { color: var(--accent); }
.repo:hover .repo__name::after { color: var(--accent); transform: translateX(3px); }
.repo__desc {
  font-size: 0.94rem;
  color: var(--text-soft);
  margin: 0;
  max-width: 60ch;
  line-height: 1.5;
}
.repo__meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.83rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.repo__lang {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.repo__lang-dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  display: inline-block;
}
@media (max-width: 540px) {
  .repo__link {
    grid-template-columns: 1fr;
  }
  .repo__meta { padding-top: 0.2rem; }
}

#repo-meta {
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* CONTACT */
.contact {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.contact li {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1rem;
  padding: 0.35rem 0;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
}
.contact li:last-child { border-bottom: 0; }
.contact__key {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
@media (max-width: 540px) {
  .contact li { grid-template-columns: 1fr; gap: 0.1rem; padding: 0.5rem 0; }
  .contact__key { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
}

/* PERSONAL CURRENTLY LINE */
.currently {
  margin: 3rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px dashed var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
  line-height: 1.5;
}
.currently em { color: var(--text-soft); }

/* FOOTER */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
}
.foot__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* SMALL PHONE */
@media (max-width: 400px) {
  .hero__photo { width: 7.5rem; }
  .topbar__inner { gap: 0.5rem; }
}
