/* ============================================================
   Itir Sayar — shared foundation
   Avenir (Book / Heavy) identity, DM Mono technical accent.
   ============================================================ */

/* Avenir mapped from installed system faces:
   regular text -> Avenir Book, bold/emphasis -> Avenir Heavy */
@font-face {
  font-family: "Avenir";
  font-style: normal;
  font-weight: 300 500;
  src: local("Avenir-Book"), local("Avenir Book"), local("Avenir-Roman"), local("Avenir");
}
@font-face {
  font-family: "Avenir";
  font-style: normal;
  font-weight: 600 900;
  src: local("Avenir-Heavy"), local("Avenir Heavy"), local("Avenir-Black"), local("Avenir");
}

@import url("https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=Newsreader:ital,opsz,wght@1,6..72,400;1,6..72,500&display=swap");

:root {
  /* brand */
  --coral: #ff955c;
  --coral-deep: #ff5900;
  --coral-light: #ffc8ab;
  --coral-pale: #fff1e8;

  /* ink + neutrals */
  --ink: #000000;
  --ink-mid: #3a3a3a;
  --ink-soft: #767676;
  --rule: #e6e6e6;
  --bg: #ffffff;
  --bg-2: #f5f5f4;
  --white: #ffffff;
  --card-bg: #f7f7f6;
  /* nav bar */
  --nav-bg: #ffffff;
  --nav-rule: #ededed;
  --nav-ink: #1a1a1a;
  --nav-chip: #f0f0f0;
  --nav-chip-ink: #000000;

  /* signal palette (used sparingly, in waveforms/diagrams) */
  --sig-1: #ff955c; /* coral  */
  --sig-2: #ff9d00; /* amber  */
  --sig-3: #5fa37f; /* green  */
  --sig-4: #10beff; /* blue   */

  /* type */
  --sans: "Avenir", "Avenir Next", ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;

  /* spacing scale (4px base) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --s9: 96px; --s10: 128px;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;

  --ease: cubic-bezier(0.22, 0.61, 0.27, 1);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.09);
  --shadow-coral: 0 12px 30px rgba(255, 149, 92, 0.28);
}

[data-theme="dark"] {
  --coral: #ff955c;
  --coral-deep: #ffb48c;
  --coral-pale: #241d1a;
  --ink: #ececea;
  --ink-mid: #b2b0ab;
  --ink-soft: #828079;
  --rule: #2a2a2a;
  --bg: #161616;
  --bg-2: #1d1d1d;
  --white: #1c1c1c;
  --card-bg: #1f1f1f;
  --nav-bg: #161616;
  --nav-rule: #2a2a2a;
  --nav-ink: #ececea;
  --nav-chip: #2e2e2e;
  --nav-chip-ink: #ffffff;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: var(--coral); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--coral-deep); }
ul { list-style: none; }
img { display: block; max-width: 100%; }

::selection { background: var(--coral); color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- technical label (mono) ---- */
.mono-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  font-weight: 500;
}

/* ---- focus chips: the "at a glance" device ---- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-mid);
  background: var(--card-bg);
  border: 1px solid var(--rule);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.chip:hover { color: var(--coral); border-color: var(--coral-light); transform: translateY(-2px); }
.chip--solid { background: var(--coral); border-color: var(--coral); color: #fff; }
[data-theme="dark"] .chip--solid { color: #1a1209; }

/* ---- pill button ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; font-size: 0.92rem;
  padding: 11px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--coral); background: transparent; color: var(--coral);
  transition: transform 0.2s var(--ease), border-color 0.2s, color 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); color: var(--coral); border-color: var(--coral); background: var(--coral-pale); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { color: var(--coral); border-color: var(--coral); background: transparent; }

/* ---- name pronunciation ---- */
.hear-name {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--ink-soft); padding: 2px 0; white-space: nowrap;
  transition: color 0.2s;
}
.hear-name:hover { color: var(--coral); }
.hear-name .wave { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.hear-name .wave i {
  width: 2px; background: currentColor; border-radius: 2px;
  height: 4px; animation: barIdle 1.4s ease-in-out infinite;
}
.hear-name .wave i:nth-child(2) { animation-delay: 0.2s; }
.hear-name .wave i:nth-child(3) { animation-delay: 0.4s; }
.hear-name .wave i:nth-child(4) { animation-delay: 0.1s; }
@keyframes barIdle { 0%,100% { height: 4px; } 50% { height: 12px; } }
.hear-name.playing .wave i { animation-duration: 0.5s; }

/* ---- theme toggle ---- */
.theme-toggle {
  background: none; border: 1px solid var(--rule); cursor: pointer;
  color: var(--ink-soft); width: 38px; height: 38px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.2s, border-color 0.2s, transform 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--coral); border-color: var(--coral-light); transform: rotate(-18deg); }

/* ---- scroll progress ---- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--coral-light));
  z-index: 9999; pointer-events: none;
}

/* ---- reveal on scroll ---- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---- abbr tooltip ---- */
abbr[title] { text-decoration: none; cursor: help; border-bottom: 1px dashed var(--coral-light); position: relative; }
abbr[title]::after {
  content: attr(title); position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) translateY(4px); background: var(--ink); color: var(--bg);
  font-family: var(--sans); font-size: 0.72rem; font-weight: 500; padding: 4px 9px;
  border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.18s, transform 0.18s; z-index: 30;
}
abbr[title]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- inline SVG icons ---- */
i[data-ic], span[data-ic] { display: inline-flex; align-items: center; justify-content: center; vertical-align: -0.14em; line-height: 0; }
[data-ic] svg { width: 1em; height: 1em; display: block; }
.theme-toggle [data-ic] svg { width: 18px; height: 18px; }
.socials [data-ic] svg, .rail-socials [data-ic] svg { width: 17px; height: 17px; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; transition: none; }
  * { scroll-behavior: auto; }
}
