/* ==========================================================================
   Bhavani Adula — portfolio
   Design system. Tokens first; components derive from tokens only.
   ========================================================================== */

:root {
  /* --- ground & ink: cool neutrals, biased toward the accent ------------- */
  --paper:      #fafbfc;
  --surface:    #eff2f5;
  --surface-2:  #e4e9ee;
  --rule:       #d7dce2;
  --rule-soft:  #e6eaee;
  --ink:        #14171c;
  --ink-2:      #39424e;
  --muted:      #5c6672;
  --muted-2:    #7d8794;

  /* --- accent: instrument teal. Spent sparingly. ------------------------ */
  --accent:     #0d5c6e;
  --accent-ink: #094654;
  --accent-wash:#dceaee;

  /* --- semantic: verification states ONLY. Never decorative. ------------ */
  --ok:         #1a6b46;
  --ok-wash:    #dceee4;
  --review:     #8a6414;
  --review-wash:#f4e9d2;
  --gap:        #9c2f2f;
  --gap-wash:   #f3dede;

  /* --- type ------------------------------------------------------------- */
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-xs:  0.75rem;
  --t-sm:  0.8125rem;
  --t-base:0.9375rem;
  --t-md:  1.0625rem;
  --t-lg:  1.375rem;
  --t-xl:  1.875rem;
  --t-2xl: 2.5rem;
  --t-3xl: clamp(2.25rem, 6vw, 3.75rem);

  /* --- space ------------------------------------------------------------ */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.5rem;   --s6: 2rem;     --s7: 3rem;     --s8: 4.5rem;
  --s9: 7rem;

  --measure: 66ch;
  --page: 1140px;
  --gutter: clamp(1rem, 4vw, 3rem);

  --radius: 3px;
  --radius-lg: 5px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0f1216;
    --surface:    #171c22;
    --surface-2:  #1f262e;
    --rule:       #2b333c;
    --rule-soft:  #222a32;
    --ink:        #e8ecf0;
    --ink-2:      #c3ccd6;
    --muted:      #8d97a4;
    --muted-2:    #6e7884;

    --accent:     #5fb8cc;
    --accent-ink: #8ad2e2;
    --accent-wash:#12323c;

    --ok:         #57c48d;
    --ok-wash:    #11291f;
    --review:     #d9a63f;
    --review-wash:#2b2214;
    --gap:        #e2736f;
    --gap-wash:   #2e1717;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:      #0f1216;
  --surface:    #171c22;
  --surface-2:  #1f262e;
  --rule:       #2b333c;
  --rule-soft:  #222a32;
  --ink:        #e8ecf0;
  --ink-2:      #c3ccd6;
  --muted:      #8d97a4;
  --muted-2:    #6e7884;

  --accent:     #5fb8cc;
  --accent-ink: #8ad2e2;
  --accent-wash:#12323c;

  --ok:         #57c48d;
  --ok-wash:    #11291f;
  --review:     #d9a63f;
  --review-wash:#2b2214;
  --gap:        #e2736f;
  --gap-wash:   #2e1717;

  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1;
}

img, svg { max-width: 100%; }
[hidden] { display: none !important; }

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--accent-wash); color: var(--ink); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: var(--s3) var(--s4); font-size: var(--t-sm);
}
.skip:focus { left: var(--s4); top: var(--s4); }

.wrap {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -0.015em; }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-lg); }

p { margin: 0 0 var(--s4); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.lede { font-size: var(--t-md); color: var(--ink-2); line-height: 1.62; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s3);
  display: flex; align-items: center; gap: var(--s3);
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px; background: var(--rule); min-width: 2rem;
}

.mono { font-family: var(--mono); font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Header
   ========================================================================== */

.masthead {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.masthead__inner {
  display: flex; align-items: center; gap: var(--s5);
  min-height: 60px;
}
.brand {
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand span { color: var(--muted); font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; margin-left: var(--s2); }

.nav { display: flex; align-items: center; gap: var(--s5); margin-left: auto; }
.nav a {
  font-size: var(--t-sm); color: var(--ink-2); text-decoration: none;
  padding-block: var(--s2);
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }

.nav__imw {
  color: var(--accent) !important;
  font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent) !important;
  border-radius: var(--radius);
  padding: var(--s2) var(--s3) !important;
  background: var(--accent-wash);
}
.nav__imw:hover { background: color-mix(in srgb, var(--accent) 18%, var(--accent-wash)); }

.theme-btn {
  background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 13px;
  flex: none;
}
.theme-btn:hover { color: var(--ink); border-color: var(--muted-2); }

@media (max-width: 860px) {
  .nav a:not(.nav__imw) { display: none; }
  .nav { gap: var(--s3); }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding-block: var(--s8) var(--s7); border-bottom: 1px solid var(--rule-soft); }

.hero__role {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--s4);
}
.hero h1 { max-width: 16ch; margin-bottom: var(--s5); }
.hero h1 em { font-style: italic; color: var(--accent); }

.hero__lede { max-width: 54ch; font-size: var(--t-md); color: var(--ink-2); margin-bottom: var(--s6); }

.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

.btn {
  font-family: var(--sans); font-size: var(--t-sm); font-weight: 500;
  padding: var(--s3) var(--s5);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: var(--s2);
  transition: background .15s, border-color .15s, color .15s;
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

.btn--primary { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn--primary,
:root:not([data-theme="light"]) .btn--primary { color: #08161a; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .btn--primary { color: #fff; } }
.btn--primary:hover { background: var(--accent-ink); }

.btn--ghost { border-color: var(--rule); color: var(--ink-2); background: transparent; }
.btn--ghost:hover { border-color: var(--muted-2); color: var(--ink); }

/* ---- the ledger: the page's thesis, gaps included --------------------- */

.ledger {
  margin-top: var(--s7);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.ledger__head {
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: baseline;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.ledger__title { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ledger__stamp { margin-left: auto; font-family: var(--mono); font-size: var(--t-xs); color: var(--muted-2); }

.ledger__grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.ledger__cell { padding: var(--s4); border-right: 1px solid var(--rule); }
.ledger__cell:last-child { border-right: 0; }
.ledger__n { font-family: var(--mono); font-size: var(--t-xl); font-variant-numeric: tabular-nums; line-height: 1; display: block; margin-bottom: var(--s2); }
.ledger__cell--ok .ledger__n { color: var(--ok); }
.ledger__cell--review .ledger__n { color: var(--review); }
.ledger__cell--gap .ledger__n { color: var(--gap); }
.ledger__k { font-size: var(--t-xs); font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: var(--s2); }
.ledger__d { font-size: var(--t-sm); color: var(--muted); margin: 0; max-width: 34ch; }

.ledger__foot {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--rule);
  font-size: var(--t-sm); color: var(--muted);
  background: var(--paper);
}

@media (max-width: 720px) {
  .ledger__grid { grid-template-columns: 1fr; }
  .ledger__cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .ledger__cell:last-child { border-bottom: 0; }
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section { padding-block: var(--s8); border-bottom: 1px solid var(--rule-soft); }
.section__head { margin-bottom: var(--s6); }
.section__head p { color: var(--muted); max-width: 58ch; margin-top: var(--s3); }

/* ==========================================================================
   Verification chips
   ========================================================================== */

.chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.04em;
  padding: 0.15em 0.5em;
  border-radius: 2px;
  border: 1px solid;
  white-space: nowrap;
  text-transform: uppercase;
}
.chip--ok     { color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 35%, transparent);     background: var(--ok-wash); }
.chip--review { color: var(--review); border-color: color-mix(in srgb, var(--review) 35%, transparent); background: var(--review-wash); }
.chip--gap    { color: var(--gap);    border-color: color-mix(in srgb, var(--gap) 35%, transparent);    background: var(--gap-wash); }
.chip--plain  { color: var(--muted);  border-color: var(--rule); background: transparent; }

.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.chip--plain::before { display: none; }

/* ==========================================================================
   Project entries
   ========================================================================== */

.projects { display: flex; flex-direction: column; gap: 0; }

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--s7);
  padding-block: var(--s6);
  border-top: 1px solid var(--rule);
  align-items: start;
}
.project:first-child { border-top: 0; padding-top: 0; }

.project__flag {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-2);
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center;
  margin-bottom: var(--s3);
}
.project h3 { margin-bottom: var(--s3); font-size: var(--t-xl); }
.project h3 a { color: inherit; text-decoration: none; }
.project h3 a:hover { color: var(--accent); }

.project__sub { color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--s4); font-family: var(--mono); }

.project__body p { margin-bottom: var(--s4); }

.project__find {
  border-left: 2px solid var(--accent);
  padding-left: var(--s4);
  margin: var(--s5) 0;
}
.project__find p { margin: 0; color: var(--ink-2); }
.project__find strong { font-weight: 600; }

.project__links { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s5); font-size: var(--t-sm); }
.project__links a { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.04em; text-transform: uppercase; }

/* evidence rail */
.rail {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s4);
  position: sticky;
  top: calc(80px + env(safe-area-inset-top, 0px));
}
.rail__t { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s3); }
.rail__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.rail__list li { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-sm); }
.rail__id { font-family: var(--mono); font-size: 0.6875rem; color: var(--muted-2); }
.rail__v { color: var(--ink-2); line-height: 1.45; }
.rail__sha { font-family: var(--mono); font-size: 0.6875rem; color: var(--muted-2); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule); display: block; word-break: break-all; }

@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; gap: var(--s5); }
  .rail { position: static; }
}

/* ==========================================================================
   Experience
   ========================================================================== */

.roles { display: flex; flex-direction: column; }
.role {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--s6);
  padding-block: var(--s5);
  border-top: 1px solid var(--rule);
}
.role:first-child { border-top: 0; padding-top: 0; }
.role__when { font-family: var(--mono); font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.04em; }
.role__where { font-weight: 600; color: var(--ink); display: block; margin-bottom: var(--s1); font-size: var(--t-base); }
.role h3 { font-size: var(--t-md); margin-bottom: var(--s3); }
.role ul { margin: 0 0 var(--s3); padding-left: 1.1em; color: var(--ink-2); }
.role li { margin-bottom: var(--s2); max-width: var(--measure); }
.role li::marker { color: var(--muted-2); }

.attrib {
  font-size: var(--t-sm); color: var(--muted);
  background: var(--surface); border-left: 2px solid var(--review);
  padding: var(--s3) var(--s4); border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: var(--s3);
}
.attrib strong { color: var(--review); font-weight: 600; }

@media (max-width: 760px) { .role { grid-template-columns: 1fr; gap: var(--s3); } }

/* ==========================================================================
   Method / skills
   ========================================================================== */

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s6) var(--s5); }
.col h4 { font-family: var(--sans); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s3); }
.col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.col li { font-size: var(--t-sm); color: var(--ink-2); display: flex; gap: var(--s2); align-items: baseline; }
.col li .chip { flex: none; }

.method { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--s5); }
.method__item { border-top: 2px solid var(--ink); padding-top: var(--s4); }
.method__item h4 { font-family: var(--display); font-size: var(--t-md); font-weight: 500; margin: 0 0 var(--s2); }
.method__item p { font-size: var(--t-sm); color: var(--muted); margin: 0; }

/* ==========================================================================
   Contextual CTA
   ========================================================================== */

.pitch {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--s6);
  display: flex; flex-wrap: wrap; gap: var(--s5); align-items: center; justify-content: space-between;
}
.pitch h3 { font-size: var(--t-lg); margin-bottom: var(--s2); }
.pitch p { color: var(--muted); margin: 0; font-size: var(--t-sm); max-width: 46ch; }

/* ==========================================================================
   Footer
   ========================================================================== */

.foot { padding-block: var(--s7) var(--s8); }
.foot__grid { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--s6); align-items: end; }
.foot h2 { font-size: var(--t-xl); margin-bottom: var(--s3); max-width: 18ch; }
.foot__links { display: flex; flex-wrap: wrap; gap: var(--s4); font-family: var(--mono); font-size: var(--t-sm); }
.foot__fine { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--rule); font-size: var(--t-xs); color: var(--muted-2); font-family: var(--mono); display: flex; flex-wrap: wrap; gap: var(--s4); justify-content: space-between; }
@media (max-width: 720px) { .foot__grid { grid-template-columns: 1fr; align-items: start; } }

/* ==========================================================================
   Floating IMW control
   ========================================================================== */

.imw-fab {
  position: fixed;
  right: var(--s5);
  bottom: calc(var(--s5) + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: var(--s3) var(--s5);
  font-family: var(--sans); font-size: var(--t-sm); font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 24px -8px rgb(0 0 0 / 0.45);
  display: inline-flex; align-items: center; gap: var(--s2);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.imw-fab[data-shown="true"] { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .imw-fab { transition: none; } }
.imw-fab:hover { background: var(--accent); border-color: var(--accent); }

/* ==========================================================================
   Role-focus mode (SHOW ON PORTFOLIO). Dims, never deletes.
   ========================================================================== */

body[data-focus] .focus-dim { opacity: 0.32; filter: saturate(0.5); transition: opacity .3s ease; }
body[data-focus] .focus-hit { outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 10px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { .focus-dim { transition: none; } }

.focusbar {
  position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 50;
  background: var(--accent-wash);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: var(--t-sm);
}
.focusbar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); padding-block: var(--s3); }
.focusbar strong { font-weight: 600; color: var(--accent-ink); }
.focusbar button {
  margin-left: auto; background: none; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent-ink); border-radius: var(--radius); padding: var(--s1) var(--s3);
  font-family: var(--mono); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
}
.focusbar button:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* No-JS note inside the contextual CTA. */
.muted-note {
  font-size: var(--t-xs);
  color: var(--muted-2);
  margin-top: var(--s3);
  max-width: 52ch;
  line-height: 1.55;
}
