/* ==========================================================================
   vivaangarg.com — site styles
   Plain CSS. No build step. Edit freely.
   ========================================================================== */

/* ---- 1. Design tokens --------------------------------------------------- */
:root {
  color-scheme: light dark;

  --paper:        #FDFAF4;
  --paper-raised: #FFFFFF;
  --ink:          #1B1613;
  --ink-soft:     #574E47;
  --ink-faint:    #8A7F76;
  --rule:         #E6DDCF;
  --rule-strong:  #D6C9B6;

  --book:         #BF4A1E;   /* books he reads   — burnt orange */
  --book-wash:    #FBEDE5;
  --screen:       #6B4FA8;   /* shows & movies   — violet */
  --screen-wash:  #EFEAF8;
  --project:      #14706B;   /* robotics projects— teal */
  --project-wash: #E2F1EF;
  --lego:         #2A5CBF;   /* LEGO builds      — blue */
  --lego-wash:    #E7EEFB;
  --game:         #96660A;   /* Scratch games    — amber */
  --game-wash:    #FAF0DC;
  --video:        #B33A5E;   /* videos           — raspberry */
  --video-wash:   #FBE9EE;
  --writing:      #2F6A4A;   /* his own writing  — deep green */
  --writing-wash: #E4F1EA;
  --accent:       var(--book);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --page:   68rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --shadow-sm: 0 1px 2px rgba(27, 22, 19, .05), 0 2px 8px rgba(27, 22, 19, .04);
  --shadow-md: 0 4px 10px rgba(27, 22, 19, .07), 0 14px 34px rgba(27, 22, 19, .08);

  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #14110F;
    --paper-raised: #1D1917;
    --ink:          #F3EDE4;
    --ink-soft:     #B9AFA4;
    --ink-faint:    #8B8078;
    --rule:         #302A26;
    --rule-strong:  #453D37;

    --book:         #F0855A;
    --book-wash:    #2E1D15;
    --screen:       #B69BEA;
    --screen-wash:  #221B33;
    --project:      #4FC4BC;
    --project-wash: #12292A;
    --lego:         #7BA5F0;
    --lego-wash:    #16233A;
    --game:         #E0B458;
    --game-wash:    #2A2113;
    --video:        #F08AA8;
    --video-wash:   #2E1720;
    --writing:      #6FCB98;
    --writing-wash: #142A1F;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 4px 10px rgba(0,0,0,.35), 0 14px 34px rgba(0,0,0,.45);
  }
}

/* ---- 2. Reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -.015em; }

/* ---- 3. Layout ---------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }
.stack > * + * { margin-top: 1rem; }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--rule); }

/* ---- 4. Header ---------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-head__inner {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 60px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .5rem;
  text-decoration: none; font-family: var(--display);
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em;
  margin-right: auto;
}
.brand__mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 8px; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  letter-spacing: .02em; transform: translateY(3px);
}
.nav { display: flex; gap: clamp(.75rem, 3vw, 1.75rem); flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: .9375rem; font-weight: 500;
  padding-block: .35rem; border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- 5. Hero ------------------------------------------------------------ */
.hero { padding-block: clamp(3.5rem, 10vw, 7rem) clamp(2.5rem, 6vw, 4rem); }
.hero__eyebrow {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 1.25rem;
}
.hero h1 {
  font-size: clamp(2.75rem, 9vw, 5rem);
  letter-spacing: -.03em; max-width: 16ch;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--book-wash) 62%);
}
.hero__lede {
  margin-top: 1.5rem; max-width: 46ch;
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  color: var(--ink-soft); line-height: 1.6;
}

/* ---- 6. Buttons & chips ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: 999px;
  font-size: .9375rem; font-weight: 600; text-decoration: none;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .6875rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  padding: .3rem .6rem; border-radius: 6px;
  background: var(--rule); color: var(--ink-soft);
}
.chip--book    { background: var(--book-wash);    color: var(--book); }
.chip--screen  { background: var(--screen-wash);  color: var(--screen); }
.chip--project { background: var(--project-wash); color: var(--project); }
.chip--lego    { background: var(--lego-wash);    color: var(--lego); }
.chip--game    { background: var(--game-wash);    color: var(--game); }
.chip--video   { background: var(--video-wash);   color: var(--video); }
.chip--writing { background: var(--writing-wash); color: var(--writing); }

/* ---- 7. Section headings ------------------------------------------------ */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem;
}
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
.section-head p { margin: .5rem 0 0; color: var(--ink-soft); max-width: 52ch; }
.section-head a {
  font-size: .875rem; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; white-space: nowrap;
}
.section-head a:hover { color: var(--ink); }

/* ---- 8. Cards ----------------------------------------------------------- */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }

.card {
  display: flex; flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--rule-strong); }
.card__media {
  aspect-ratio: 16 / 10; background: var(--rule);
  display: grid; place-items: center; overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--contain { padding: .9rem; }
.card__media--contain img { object-fit: contain; filter: drop-shadow(0 3px 10px rgba(0,0,0,.28)); }
.card__media--empty { font-size: 2.75rem; opacity: .55; }
.card__media--book    { background: var(--book-wash); }
.card__media--screen  { background: var(--screen-wash); }
.card__media--project { background: var(--project-wash); }
.card__media--lego    { background: var(--lego-wash); }
.card__media--game    { background: var(--game-wash); }
.card__media--video   { background: var(--video-wash); }
.card__media--writing { background: var(--writing-wash); }
.card__body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card__meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card__date { font-family: var(--mono); font-size: .75rem; color: var(--ink-faint); }
.card__title { font-size: 1.1875rem; letter-spacing: -.01em; }
.card__blurb { margin: 0; font-size: .9375rem; color: var(--ink-soft); line-height: 1.55; }
.card__blurb--clamp {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__foot { margin-top: auto; padding-top: .35rem; font-size: .8125rem; font-weight: 600; color: var(--ink-faint); }
.card:hover .card__foot { color: var(--ink); }

.stars { font-size: .875rem; letter-spacing: .1em; color: var(--book); }

.empty-note {
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  padding: 2rem; text-align: center; color: var(--ink-faint); font-size: .9375rem;
}

/* ---- 9. Two-door panel (home) ------------------------------------------- */
.doors { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.door {
  position: relative; display: block; text-decoration: none;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--paper-raised); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.door:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.door::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--accent, var(--ink));
}
.door--book    { --accent: var(--book); }
.door--screen  { --accent: var(--screen); }
.door--project { --accent: var(--project); }
.door--lego    { --accent: var(--lego); }
.door--game    { --accent: var(--game); }
.door--video   { --accent: var(--video); }
.door--writing { --accent: var(--writing); }
.door__icon { font-size: 1.75rem; line-height: 1; }
.door h3 { font-size: 1.3125rem; margin-top: .85rem; }
.door p { margin: .5rem 0 0; color: var(--ink-soft); font-size: .9375rem; }
.door__go { margin-top: 1rem; font-size: .875rem; font-weight: 600; color: var(--accent); }

/* ---- 10. Article (post pages) ------------------------------------------- */
.article { max-width: 46rem; padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem); }
.article__back {
  display: inline-block; font-size: .875rem; font-weight: 600;
  color: var(--ink-faint); text-decoration: none; margin-bottom: 2rem;
}
.article__back:hover { color: var(--ink); }
.article__head { max-width: 34rem; }
.article__head h1 { font-size: clamp(2rem, 5.5vw, 3rem); margin-top: 1rem; }
.article__dek { margin: 1rem 0 0; font-size: 1.125rem; color: var(--ink-soft); }
.article__figure { margin: 2.5rem 0; }
.article__figure img { border-radius: var(--radius); border: 1px solid var(--rule); }
.article__figure figcaption { margin-top: .65rem; font-size: .8125rem; color: var(--ink-faint); }

.prose { max-width: 34rem; margin-top: 2.5rem; }
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: 1.25rem; }
.prose > * + blockquote, .prose > blockquote + * { margin-top: 2rem; }
.prose h2 { font-size: 1.4375rem; }
.prose > * + h2 { margin-top: 2.75rem; }
.prose h3 { font-size: 1.1875rem; }
.prose > * + h3 { margin-top: 2.25rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: .4rem; }
.prose a { color: var(--book); text-underline-offset: 3px; }
.prose blockquote {
  padding: .25rem 0 .25rem 1.25rem;
  border-left: 3px solid var(--rule-strong);
  font-family: var(--display); font-size: 1.1875rem; color: var(--ink-soft);
}
.prose code {
  font-family: var(--mono); font-size: .875em;
  background: var(--rule); padding: .15em .4em; border-radius: 5px;
}
.prose pre {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1rem 1.15rem;
  overflow-x: auto; font-family: var(--mono); font-size: .875rem; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--rule); }

.factbox {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-raised); padding: 1.25rem 1.35rem;
  font-size: .9375rem; max-width: 34rem;
}
.factbox dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; }
.factbox dt { font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.factbox dd { margin: 0; }

/* ---- 11. About ---------------------------------------------------------- */
.about { display: grid; gap: clamp(2rem, 5vw, 3.5rem); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 46rem) { .about { grid-template-columns: 15rem minmax(0, 1fr); } }
.about__portrait { border-radius: var(--radius); border: 1px solid var(--rule); background: var(--rule); aspect-ratio: 4/5; display: grid; place-items: center; font-family: var(--mono); color: var(--ink-faint); font-size: .8125rem; text-align: center; padding: 1rem; }

/* ---- 12. Footer --------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3rem;
  font-size: .875rem; color: var(--ink-faint);
}
.site-foot__inner { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.site-foot a { color: var(--ink-soft); text-decoration: none; }
.site-foot a:hover { color: var(--ink); }
.site-foot__links { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* ---- 13. Utilities ------------------------------------------------------ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
:where(a, button, input, textarea):focus-visible {
  outline: 2px solid var(--book); outline-offset: 3px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- 14. Small screens --------------------------------------------------- */
@media (max-width: 40rem) {
  .site-head__inner { gap: 1rem; min-height: 54px; }
  /* keep the header on one line: mark only, no wordmark */
  .brand > span:not(.brand__mark) { display: none; }
  .nav {
    gap: 1rem; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin-inline: -.25rem; padding-inline: .25rem;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { font-size: .875rem; white-space: nowrap; }
  .hero { padding-block: 2.5rem 2rem; }
  .btn-row { margin-top: 1.5rem; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .factbox dl { grid-template-columns: 1fr; gap: .15rem; }
  .factbox dd + dt { margin-top: .75rem; }
  .site-foot__inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* ---- 15. Filter bar ------------------------------------------------------ */
.filters {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-bottom: 1.75rem;
}
.filters button {
  font: inherit; font-size: .875rem; font-weight: 500;
  padding: .45rem .9rem; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.filters button:hover { color: var(--ink); border-color: var(--ink-faint); }
.filters button[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

/* ---- 16. Video embeds ---------------------------------------------------- */
.video-embed {
  position: relative; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--rule); background: #000;
  margin-top: 2rem;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.card__media--play { position: relative; }
.card__media--play::after {
  content: "▶"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 1.5rem; color: #fff;
  background: rgba(0,0,0,.28); text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

/* ---- 17. Published books ------------------------------------------------- */
.books-out { display: grid; gap: 1.5rem; }
.bookout {
  display: grid; gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}
@media (min-width: 40rem) { .bookout { grid-template-columns: 10.5rem minmax(0, 1fr); } }

.bookout__cover {
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-md);
  max-width: 10.5rem;
}
.bookout__cover img { width: 100%; height: auto; display: block; }
/* stand-in cover, used until a real jacket image is added */
.bookout__cover--placeholder {
  aspect-ratio: 2 / 3;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: .9rem .8rem;
  background: linear-gradient(160deg, var(--accent, var(--writing)), color-mix(in srgb, var(--accent, var(--writing)) 62%, #000));
  color: #fff; border-color: transparent;
}
.bookout__cover--placeholder .t {
  font-family: var(--display); font-size: 1rem; line-height: 1.15; font-weight: 600;
}
.bookout__cover--placeholder .a {
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .12em;
  text-transform: uppercase; opacity: .85;
}

.bookout__body > * + * { margin-top: .75rem; }
.bookout__body h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
.bookout__body h3 a { color: inherit; text-decoration: none; }
.bookout__body h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.bookout__meta {
  margin: 0; font-family: var(--mono); font-size: .75rem;
  letter-spacing: .04em; color: var(--ink-faint);
}
.bookout__blurb { margin: 0; color: var(--ink-soft); font-size: .9375rem; line-height: 1.6; max-width: 46ch; }
.bookout .btn-row { margin-top: 1.25rem; }
.bookout .btn { padding: .55rem .95rem; font-size: .875rem; }

/* ---- 18. Feedback form --------------------------------------------------- */
.respond {
  margin-top: 3.5rem; padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
  max-width: 34rem;
}
.respond h2 { font-size: 1.4375rem; }
.respond__intro { margin: .75rem 0 0; color: var(--ink-soft); font-size: .9375rem; }

.respond__ways { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.feedback { margin-top: 1.75rem; display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.field .hint { font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: .75rem; }
.field input, .field textarea {
  font: inherit; font-size: .9375rem;
  padding: .65rem .8rem; border-radius: 10px;
  background: var(--paper-raised); color: var(--ink);
  border: 1px solid var(--rule-strong);
  transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--book); }
.field textarea { min-height: 7.5rem; resize: vertical; line-height: 1.6; }
.feedback button { justify-self: start; }
.feedback button.btn { border: 1px solid var(--ink); cursor: pointer; }
.respond__note { margin: 0; font-size: .8125rem; color: var(--ink-faint); }

/* honeypot — hidden from people, catches spam robots */
.no-fill { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- 19. Scratch game embeds --------------------------------------------- */
.scratch-embed {
  margin-top: 2rem; max-width: 485px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; background: var(--paper-raised);
}
.scratch-embed__frame { position: relative; aspect-ratio: 485 / 402; }
.scratch-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.scratch-embed__note {
  margin: 0; padding: .6rem .85rem;
  border-top: 1px solid var(--rule);
  font-size: .8125rem; color: var(--ink-faint);
}
.scratch-embed__note a { color: var(--game); }
