/* =========================================================
   site.css — pi.website-inspired styles for pranav6670.github.io
   Fraunces (serif display) + Source Sans 3 (body) + system mono
   ========================================================= */

/* ---- Design tokens ---- */
:root {
  --bg: #F5F4EF;
  --fg: #000000;
  --muted: #686868;
  --muted-fill: #E5E4DC;
  --border: rgba(64, 62, 55, 0.16);
  --border-strong: rgba(64, 62, 55, 0.55);
  --card: #FFFFFF;
  --accent-gold: #E0BC4E;
  --accent-gold-ink: #7a6010;
  --accent-blue: #C8DEDF;

  /* Signifier (pi.website's serif) is commercial — listed first so a licensed
     @font-face drop-in takes over instantly; Fraunces is the live stand-in. */
  --font-serif: "Signifier", "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --maxw-read: 680px;
  --maxw-page: 1120px;
  --pad-x: clamp(1.25rem, 5vw, 3rem);
  --space-section: clamp(3.5rem, 9vw, 7rem);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
ul { list-style: none; padding: 0; }

/* ---- Headings ---- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: 1.12;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

/* ---- Layout helpers ---- */
.container { width: 100%; max-width: var(--maxw-page); margin-inline: auto; padding-inline: var(--pad-x); }
.section { padding-block: var(--space-section); scroll-margin-top: 5rem; }
.section + .section { border-top: 1px solid var(--border); }
.section__title { font-size: clamp(1.6rem, 3.2vw, 2.1rem); font-weight: 500; margin-bottom: 2.5rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.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; }

/* ---- Nav ---- */
.nav { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .3s ease; }
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner { max-width: var(--maxw-page); margin-inline: auto; padding: 1rem var(--pad-x); display: flex; align-items: center; justify-content: space-between; }
.nav__brand { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 400; letter-spacing: -0.01em; }
.nav__menu { display: flex; gap: 2rem; align-items: center; }
.nav__menu a { font-family: var(--font-mono); font-size: 0.875rem; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; transition: color .2s ease; }
.nav__menu a:hover { color: var(--muted); }
.nav__toggle { display: none; width: 2rem; height: 2rem; flex-direction: column; justify-content: center; gap: 5px; }
.nav__toggle span { display: block; height: 1.5px; width: 1.4rem; background: var(--fg); }

/* ---- Hero ---- */
.hero { padding-block: clamp(1rem, 2.5vh, 2rem); }
.hero .container { max-width: 1200px; padding-inline: clamp(0.75rem, 2.5vw, 2.5rem); }
.hero .eyebrow { display: block; margin-bottom: 1.25rem; }
.hero__title { font-size: clamp(2.6rem, 7vw, 4.5rem); line-height: 1.04; margin-bottom: 1.5rem; }
.hero__lead { font-family: var(--font-serif); font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.4; max-width: 32ch; margin-bottom: 1.75rem; }
.hero__intro { max-width: var(--maxw-read); color: #222; }

/* ---- About (split master-detail) ---- */
.about { display: grid; grid-template-columns: minmax(170px, 220px) 1fr; gap: clamp(2rem, 5vw, 4.5rem); }
.about-nav { display: flex; flex-direction: column; gap: 0.25rem; border-right: 1px solid var(--border); padding-right: 1rem; }
.about-nav button { text-align: left; padding: 0.5rem 0; font-size: 1.05rem; color: var(--muted); transition: color .2s ease; position: relative; }
.about-nav button:hover, .about-nav button.is-active { color: var(--fg); }
.about-nav button.is-active::before { content: ""; position: absolute; left: -1rem; top: 50%; transform: translateY(-50%); width: 2px; height: 1.1em; background: var(--accent-gold); }
.about-panel { display: none; }
.about-panel.is-active { display: block; }
.about-panel__header { display: none; }
.about-panel__body { max-width: var(--maxw-read); }
.about-panel__body p + p { margin-top: 1rem; }
.about-panel h3 { font-size: 1.4rem; font-weight: 500; margin-bottom: 1rem; }
.about-panel__header span { display: inline-block; transition: transform .2s ease; }
.about-panel.is-open .about-panel__header span { transform: rotate(45deg); }

/* ---- Projects feed ---- */
.feed { border-top: 1px solid var(--border); }
.feed__item { border-bottom: 1px solid var(--border); }
.feed__link { display: block; padding: 1.75rem 0; transition: padding-left .25s ease; }
.feed__link:hover { padding-left: 0.75rem; }
.feed__meta { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.feed__title { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 500; margin: 0.5rem 0; }
.feed__link:hover .feed__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.feed__desc { color: var(--muted); max-width: 60ch; }

/* ---- Article (project detail) — pi.website blog anatomy ---- */
.article { max-width: 768px; margin-inline: auto; padding: clamp(2rem, 6vw, 3.5rem) var(--pad-x) var(--space-section); }
.article__back { font-family: var(--font-mono); font-size: 0.875rem; color: var(--muted); display: inline-block; margin-bottom: 2.5rem; }
.article__back:hover { color: var(--fg); }
.article__title { font-size: clamp(2.4rem, 5vw, 3.75rem); line-height: 1.25; margin-bottom: 1.5rem; }
.article__facts { display: grid; grid-template-columns: 7.5rem 1fr; row-gap: 0.5rem; align-items: baseline; margin: 0 0 2.5rem; font-family: var(--font-mono); font-size: 0.875rem; color: var(--fg); }
.article__facts dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.article__facts dd { margin: 0; }
.article__facts a { text-decoration: underline; text-underline-offset: 3px; }
.article__facts a:hover { color: var(--muted); }
.article__more { font-family: var(--font-mono); font-size: 0.875rem; color: var(--muted); margin-top: 2.5rem; }
.article__more a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.article__figure { width: min(1000px, 92vw); margin: 2.5rem 0 2.5rem 50%; transform: translateX(-50%); }
.article__figure img { border: 0; border-radius: 8px; }
.article p { margin-bottom: 1rem; line-height: 1.625; }
.article h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.25; margin: 2.5rem 0 1rem; }
.article__list { margin: 0 0 1.5rem 1.1rem; list-style: disc; }
.article__list li { margin-bottom: 0.4rem; }
.article__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.5rem; }

/* ---- Long-form article extensions (blog posts) ---- */
.article h3 { font-size: 1.05rem; font-weight: 600; font-family: var(--font-sans); line-height: 1.3; margin: 2rem 0 0.75rem; }
.article__toc { font-family: var(--font-mono); font-size: 0.85rem; margin: 0 0 2.5rem; padding: 1.1rem 0 1.25rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); columns: 2; column-gap: 2.5rem; }
.article__toc li { margin-bottom: 0.35rem; break-inside: avoid; }
.article__toc a { color: var(--fg); }
.article__toc a:hover { color: var(--muted); }
.article__toc .toc-n { color: var(--muted); display: inline-block; min-width: 2em; }
.article section { scroll-margin-top: 5rem; }
.callout { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent-gold); border-radius: 8px; padding: 1.1rem 1.3rem; margin: 1.75rem 0; }
.callout__label { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-gold-ink); margin-bottom: 0.5rem; }
.callout p { margin-bottom: 0.75rem; }
.callout p:last-child { margin-bottom: 0; }
.callout--fieldnote { border-left-color: var(--accent-blue); }
.callout--fieldnote .callout__label { color: #46686a; }
.article__tablewrap { overflow-x: auto; margin: 1.75rem 0; }
.article__tablewrap table { border-collapse: collapse; width: 100%; font-size: 0.92rem; line-height: 1.45; }
.article__tablewrap th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; text-align: left; padding: 0.45rem 1rem 0.45rem 0; border-bottom: 1px solid var(--border-strong); }
.article__tablewrap td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.article__tablewrap tr.rule td { border-bottom: 1px solid var(--border-strong); }
.article__tablewrap caption { caption-side: bottom; text-align: left; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); padding-top: 0.6rem; }
.article__figure figcaption { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); line-height: 1.5; margin-top: 0.6rem; }
.article__figure video { width: 100%; border-radius: 8px; display: block; }
.article__figure--narrow { width: min(420px, 92vw); }
.article__figure--wide { width: min(1280px, 96vw); }
.article__figure a { display: block; }
.article__shots { display: flex; gap: 10px; justify-content: center; align-items: flex-start; }
.article__shots img { flex: 1 1 0; min-width: 0; border-radius: 8px; }
.article__math { font-family: var(--font-mono); font-size: 0.95rem; text-align: center; margin: 1.25rem 0; color: var(--fg); }
.article code { font-family: var(--font-mono); font-size: 0.86em; background: var(--muted-fill); border-radius: 3px; padding: 0.08em 0.35em; }
.article sup { line-height: 0; }
.article sup a { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.article sup a:hover { color: var(--fg); }
.article__refs { margin: 0 0 1.5rem 1.3rem; font-size: 0.92rem; color: var(--fg); list-style: decimal; }
.article__refs li { margin-bottom: 0.5rem; }
.article__refs a { text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.article__refs a:hover { color: var(--muted); }
@media (max-width: 600px) {
  .article__toc { columns: 1; }
}

/* ---- Buttons ---- */
.btn { display: inline-block; font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.03em; text-transform: uppercase; padding: 0.7rem 1.25rem; border: 1px solid var(--border-strong); border-radius: 2px; transition: background .2s ease, color .2s ease; }
.btn:hover { background: var(--fg); color: var(--bg); }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--border); padding-block: 3rem; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.footer__social { display: flex; gap: 1.5rem; }
.footer__social a { color: var(--muted); font-size: 0.95rem; transition: color .2s ease; }
.footer__social a:hover { color: var(--fg); }
.footer__copy { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }

/* ---- Terminal (interactive, hero) ---- */
.term {
  max-width: 1080px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 4rem);
  min-height: calc(100svh - 4rem);
  background: #1B1A17;
  color: #E8E5DB;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  border-radius: 6px;
  border: 1px solid rgba(27, 26, 23, 0.9);
  box-shadow: 0 24px 60px -16px rgba(64, 62, 55, 0.5), 0 6px 18px rgba(64, 62, 55, 0.2);
  overflow: hidden;
}
.term:focus-within { box-shadow: 0 18px 50px -12px rgba(64, 62, 55, 0.45), 0 0 0 3px rgba(224, 188, 78, 0.35); }
.term__bar { position: relative; display: flex; align-items: center; padding: 0.6rem 0.9rem; background: #26241F; }
.term__dots { display: flex; gap: 7px; }
.term__dots span { width: 12px; height: 12px; border-radius: 50%; }
.term__dots span:nth-child(1) { background: #FF5F57; }
.term__dots span:nth-child(2) { background: #FEBC2E; }
.term__dots span:nth-child(3) { background: #28C840; }
.term__title { position: absolute; left: 50%; transform: translateX(-50%); color: #8B887C; font-size: 0.72rem; letter-spacing: 0.04em; white-space: nowrap; }
.term__body { flex: 1; padding: clamp(1.25rem, 2.5vw, 2rem) clamp(1rem, 2.75vw, 2.25rem); }
.term__banner { color: var(--accent-gold); font-family: inherit; font-size: clamp(7px, 2.1vw, 14px); line-height: 1.3; margin-bottom: 1.25rem; overflow: hidden; }
.term__banner-line { white-space: pre; font-size: clamp(7px, 2.1vw, 14px); line-height: 1.3; color: var(--accent-gold); overflow: hidden; }
.term__intro > .term__entry:first-of-type { margin-top: 0; }
.term__line { white-space: pre-wrap; word-break: break-word; }
.term__entry { margin-top: 0.9rem; }
.term__entry .term__line + .term__line { margin-top: 0.15rem; }
.term__prompt { display: flex; gap: 0.6rem; align-items: baseline; margin-top: 0.75rem; }
.term__ps1 { color: var(--accent-gold); white-space: nowrap; }
.term__input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 0; color: inherit; font: inherit; caret-color: var(--accent-gold); border-radius: 0; }
.term .c-prompt { color: var(--accent-gold); }
.term .c-gold { color: var(--accent-gold); }
.term .c-muted { color: #8B887C; }
.term .c-err { color: #E8896C; }
.term a, .term .c-link { color: var(--accent-blue); text-decoration: underline; text-underline-offset: 3px; }
.term a:hover { color: #FFFFFF; }

/* ---- No-JS fallback ---- */
.noscript { max-width: var(--maxw-read); padding-block: 2rem; }
.noscript a { text-decoration: underline; text-underline-offset: 3px; }
.noscript ul { margin-top: 1rem; }
.noscript li { margin-bottom: 0.4rem; }

/* ---- Reveal on scroll ---- */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav__toggle { display: flex; }
  .nav__menu { position: fixed; inset: 4rem 0 auto 0; background: var(--bg); flex-direction: column; gap: 1.25rem; padding: 1.5rem var(--pad-x) 2rem; border-bottom: 1px solid var(--border); transform: translateY(-115%); transition: transform .3s ease; pointer-events: none; }
  .nav__menu--static { position: static; transform: none; flex-direction: row; gap: 1.25rem; padding: 0; border: 0; pointer-events: auto; }
  body.nav-open .nav__menu { transform: translateY(0); pointer-events: auto; }

  .term { font-size: 0.8rem; min-height: calc(100vh - 2.5rem); min-height: calc(100svh - 2.5rem); }
  .term__body { padding: 1.1rem 1rem 1.25rem; }

  .about { display: block; }
  .about-nav { display: none; }
  .about-panel { display: block; border-bottom: 1px solid var(--border); }
  .about-panel__header { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 1.1rem 0; font-family: var(--font-serif); font-size: 1.2rem; }
  .about-panel__body { display: none; padding-bottom: 1.25rem; }
  .about-panel.is-open .about-panel__body { display: block; }
}

/* ---- Touch: keep iOS from zooming the terminal input on focus ---- */
@media (pointer: coarse) {
  .term__input { font-size: 16px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
