/* ───────────────────────────────────────────────────────────────────────
   itsamod.dev — global styles
   System-aware via prefers-color-scheme; tweaks override via [data-theme]
─────────────────────────────────────────────────────────────────────── */

/* Light (default) */
:root {
  --bg:           #f7f5f0;
  --bg-elev:     #fdfbf6;
  --bg-soft:     #efece4;
  --fg:           #1a1814;
  --fg-soft:     #45413a;
  --fg-muted:    #7a766c;
  --fg-faint:    #b3aea2;
  --line:         rgba(26, 24, 20, 0.10);
  --line-soft:   rgba(26, 24, 20, 0.05);
  --accent:       #c2410c;          /* warm rust */
  --accent-soft: rgba(194, 65, 12, 0.10);
  --shadow-card: 0 1px 0 rgba(26,24,20,0.04), 0 8px 24px -12px rgba(26,24,20,0.08);

  /* Map */
  --map-dot:      rgba(26, 24, 20, 0.22);
  --map-dot-on:   var(--accent);

  /* Typography */
  --font-serif:   "Instrument Serif", "EB Garamond", Georgia, serif;
  --font-sans:    "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text",
                   "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono",
                   Menlo, Consolas, monospace;
}

/* Dark (system) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0e0d0c;
    --bg-elev:     #15140f;
    --bg-soft:     #1c1a16;
    --fg:           #f1ede4;
    --fg-soft:     #d4cfc3;
    --fg-muted:    #908a7d;
    --fg-faint:    #5c574d;
    --line:         rgba(241, 237, 228, 0.10);
    --line-soft:   rgba(241, 237, 228, 0.05);
    --accent:       #ef885a;          /* warmer in dark */
    --accent-soft: rgba(239, 136, 90, 0.15);
    --shadow-card: 0 1px 0 rgba(0,0,0,0.4), 0 12px 32px -16px rgba(0,0,0,0.6);

    --map-dot:      rgba(241, 237, 228, 0.22);
  }
}

/* Tweak-forced themes override the media query */
:root[data-theme="light"] {
  --bg:           #f7f5f0;
  --bg-elev:     #fdfbf6;
  --bg-soft:     #efece4;
  --fg:           #1a1814;
  --fg-soft:     #45413a;
  --fg-muted:    #7a766c;
  --fg-faint:    #b3aea2;
  --line:         rgba(26, 24, 20, 0.10);
  --line-soft:   rgba(26, 24, 20, 0.05);
  --shadow-card: 0 1px 0 rgba(26,24,20,0.04), 0 8px 24px -12px rgba(26,24,20,0.08);
  --map-dot:      rgba(26, 24, 20, 0.22);
}
:root[data-theme="dark"] {
  --bg:           #0e0d0c;
  --bg-elev:     #15140f;
  --bg-soft:     #1c1a16;
  --fg:           #f1ede4;
  --fg-soft:     #d4cfc3;
  --fg-muted:    #908a7d;
  --fg-faint:    #5c574d;
  --line:         rgba(241, 237, 228, 0.10);
  --line-soft:   rgba(241, 237, 228, 0.05);
  --shadow-card: 0 1px 0 rgba(0,0,0,0.4), 0 12px 32px -16px rgba(0,0,0,0.6);
  --map-dot:      rgba(241, 237, 228, 0.22);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.7 var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  transition: background 200ms ease, color 200ms ease;
}

/* ── Layout container ─────────────────────────────────────────────── */
.site {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 28px;
}
.site--wide {
  max-width: 920px;
}

.section {
  padding: 64px 0;
  border-top: 1px solid var(--line-soft);
}
.section:first-of-type { border-top: 0; }
.section__label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section__label::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--fg-muted);
  display: inline-block;
}

/* ── Typography ───────────────────────────────────────────────────── */
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; }
.mono  { font-family: var(--font-mono); font-size: 0.92em; }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 160ms ease, color 160ms ease;
}
a:hover { border-color: var(--accent); color: var(--accent); }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

/* ── Nav ──────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.nav__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav__brand:hover { color: var(--accent); }
.nav__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav__links {
  display: flex;
  gap: 22px;
  font-size: 14px;
  color: var(--fg-soft);
  align-items: center;
}
.nav__links a { border: 0; }
.nav__links a:hover { color: var(--accent); }

.theme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: -2px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--accent);
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  padding: 96px 0 72px;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0);    }
}

.hero__headline {
  font-size: clamp(40px, 6vw, 58px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.06;
  margin: 0 0 22px;
  color: var(--fg);
  text-wrap: balance;
}
.hero__headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.hero__sub {
  font-size: 17px;
  color: var(--fg-muted);
  margin: 0 0 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}
.hero__sub span { white-space: nowrap; }
.hero__sub i {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--fg-faint);
  vertical-align: middle;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  font-size: 14.5px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  border: 0;
  font: 500 14.5px/1 var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}
.btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  border-color: transparent;
}
.btn__arrow { transition: transform 160ms ease; }
.btn:hover .btn__arrow { transform: translate(2px, -2px); }

.hero__links {
  display: flex;
  gap: 16px;
  margin-left: 4px;
  color: var(--fg-muted);
}
.hero__links a {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 6px 2px;
}
.hero__links a:hover { color: var(--accent); }
.hero__links svg {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}

/* ── About ────────────────────────────────────────────────────────── */
.about__photo {
  float: right;
  margin: 4px 0 16px 28px;
  display: block;
  shape-outside: circle();
  border-radius: 50%;
  /* Placeholder text inherits host color; override so it reads in dark mode. */
  color: var(--fg-muted);
  /* Subtle dashed ring so the empty slot is discoverable on dark bg. */
  outline: 1px dashed var(--line);
  outline-offset: -1px;
  background: var(--bg-soft);
  box-shadow: 0 8px 28px -16px rgba(0,0,0,0.35);
}
.about__photo[data-filled] {
  outline: 0;
  background: transparent;
  box-shadow: 0 1px 0 var(--line) inset, 0 10px 28px -14px rgba(0,0,0,0.4);
}
@media (max-width: 560px) {
  .about__photo {
    float: none;
    margin: 0 0 22px;
  }
}

.about p {
  font-size: 18px;
  line-height: 1.65;
  color: var(--fg-soft);
  letter-spacing: -0.003em;
}
.about p em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--fg);
  letter-spacing: 0;
}

/* ── Work ─────────────────────────────────────────────────────────── */
.work__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.work__item {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  align-items: start;
}
.work__item:first-child { border-top: 0; padding-top: 4px; }
/* Detail-less entries (no body, no tags) sit tighter and don't leave a gap. */
.work__item--compact { padding: 16px 0; }
.work__item--compact .work__role { margin-bottom: 0; }
.work__when {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-muted);
  padding-top: 7px;
  letter-spacing: -0.005em;
}
.work__heading {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.work__role {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.work__body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--fg-soft);
}
.work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}

@media (max-width: 640px) {
  .work__item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .work__when { padding-top: 0; margin-bottom: 4px; }
}

/* ── Projects ─────────────────────────────────────────────────────── */
.projects__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  background: var(--bg-elev);
  transition: transform 180ms cubic-bezier(.2,.7,.2,1),
              border-color 180ms ease, box-shadow 180ms ease;
  position: relative;
  overflow: hidden;
}
.project:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
  color: inherit;
}
.project__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 22px;
}
.project__name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
  white-space: nowrap;
  flex-shrink: 0;
}
.project__status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  flex-shrink: 0;
  white-space: nowrap;
}
.project__arrow {
  margin-left: auto;
  color: var(--fg-muted);
  transition: transform 200ms ease, color 200ms ease;
}
.project:hover .project__arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}
.project__desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-soft);
  margin: 0;
}

/* ── Map ──────────────────────────────────────────────────────────── */
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  margin: 8px 0 24px;
}
.map svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.map__dot,
.map__dots circle {
  fill: var(--map-dot);
}
.map__city {
  fill: var(--accent);
  cursor: pointer;
  transition: r 180ms cubic-bezier(.2,.7,.2,1);
  filter: drop-shadow(0 0 0 transparent);
}
.map__city:hover {
  filter: drop-shadow(0 0 8px var(--accent));
}
.map__ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
}
.map__city-group:hover .map__ring,
.map__city-group.is-active .map__ring {
  animation: ping 1.6s ease-out infinite;
}
@keyframes ping {
  0%   { opacity: 0.5; r: 4; }
  100% { opacity: 0;   r: 18; }
}

.map__tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: -0.005em;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  opacity: 0;
  transition: opacity 140ms ease;
  z-index: 5;
}
.map__tooltip.show { opacity: 1; }
.map__tooltip::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 7px; height: 7px;
  background: var(--fg);
}
.map__tooltip b { font-weight: 500; }
.map__tooltip i {
  display: block;
  font-style: normal;
  opacity: 0.7;
  font-size: 10.5px;
  margin-top: 2px;
}

.map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.map__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.map__legend-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  padding: 64px 0 80px;
  border-top: 1px solid var(--line-soft);
  color: var(--fg-muted);
  font-size: 14px;
}
.footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.footer__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line) !important;
  border-radius: 10px;
  color: var(--fg-muted);
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.footer__icon:hover {
  color: var(--accent);
  border-color: var(--accent) !important;
  transform: translateY(-2px);
}
.footer__icon svg {
  width: 19px;
  height: 19px;
  opacity: 0.9;
}
.footer__meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
  border-top: 1px solid var(--line-soft);
  padding-top: 24px;
}
.footer__meta b { color: var(--fg-muted); font-weight: 500; }

/* ── Stagger-in load animation ────────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 700ms cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Density variants ─────────────────────────────────────────────── */
:root[data-density="compact"] .section { padding: 44px 0; }
:root[data-density="compact"] .hero    { padding: 72px 0 52px; }
:root[data-density="comfy"] .section   { padding: 84px 0; }
:root[data-density="comfy"] .hero      { padding: 120px 0 92px; }

/* ── Font-pair variants (set on :root) ────────────────────────────── */
:root[data-fontpair="editorial"] {
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans:  "Geist", -apple-system, sans-serif;
  --font-mono:  "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
}
:root[data-fontpair="literary"] {
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans:  "Newsreader", Georgia, serif;
  --font-mono:  "JetBrains Mono", ui-monospace, monospace;
}
:root[data-fontpair="terminal"] {
  --font-serif: "JetBrains Mono", ui-monospace, monospace;
  --font-sans:  "JetBrains Mono", ui-monospace, monospace;
  --font-mono:  "JetBrains Mono", ui-monospace, monospace;
}
:root[data-fontpair="terminal"] .hero__headline em { font-style: normal; }
:root[data-fontpair="terminal"] body { font-size: 15.5px; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .fade-up { animation: none; opacity: 1; transform: none; }
  .hero__pulse { animation: none; }
  .map__city-group:hover .map__ring { animation: none; }
  html { scroll-behavior: auto; }
}
