/* ==========================================================================
   Bhanu Vadlamudi, profile site
   Warm editorial with mono accents. Light default, manual dark toggle.
   No framework, no build step. See ../SPEC.md
   ========================================================================== */

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/serif.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/mono.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* --- Tokens ------------------------------------------------------------- */

:root {
  --bg:            #FAF8F5;
  --surface:       #FFFFFF;
  --text:          #1A1815;
  --text-muted:    #6B655C;
  --border:        #E5E0D8;
  --accent:        #4F7A3C;  /* textual: 4.9:1 on --bg, passes AA */
  --accent-bright: #6A9C55;  /* non-text UI: 3.1:1, passes the 3:1 bar */

  --serif: 'Instrument Serif', Georgia, 'Iowan Old Style', serif;
  --sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --spine-x: 64px;
  --entry-pad: 104px;

  /* Scroll runway above and below the entries. Without it the pointer line can
     never reach the first or last entry: at scroll 0 the line is already below
     entry one, and the page stops scrolling while the last entry is still below
     the line. Zero on mobile, where the pointer is disabled. */
  --rail-top: 12vh;
  --rail-bottom: 22vh;
  --rail-line: 33vh;   /* where the pointer sits in the viewport */
  --maxw: 1200px;
}

:root[data-theme="dark"] {
  --bg:            #141210;
  --surface:       #1D1A16;
  --text:          #EDE8E0;
  --text-muted:    #9A9288;
  --border:        #2E2A24;
  --accent:        #8FBF72;
  --accent-bright: #8FBF72;
}

/* --- Reset -------------------------------------------------------------- */

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

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

/* fixed, not absolute: an absolutely-positioned skip link lands 16px from the
   DOCUMENT top, which is off-screen on a scrolled page. */
.skip-link {
  position: fixed; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: 12px 20px; border: 1px solid var(--border); z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

.dot-sep { color: var(--border); padding: 0 2px; }

/* --- Theme toggle ------------------------------------------------------- */

.theme-toggle {
  position: fixed; top: 20px; right: 20px; z-index: 50;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--bg); color: var(--text-muted);
  transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-bright); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* --- Page shell --------------------------------------------------------- */

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 36% 1fr;
  gap: 72px;
  align-items: start;
}

/* --- Identity card ------------------------------------------------------ */

.identity { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; }
.identity-inner { padding: 48px 0; max-width: 34ch; }

.mark {
  font-family: var(--mono);
  font-size: 28px; line-height: 1;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: -0.02em;
}
.mark-paren  { font-weight: 700; }
.mark-star   { color: var(--accent-bright); }
.mark-letter { color: var(--text); }

.name {
  font-family: var(--serif);
  font-size: 48px; line-height: 1.05; font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.role {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.positioning { font-size: 17px; line-height: 1.65; margin-bottom: 28px; }
.positioning-quiet { color: var(--text-muted); }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 100px;
  padding: 6px 14px; margin-bottom: 36px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-bright); flex-shrink: 0;
}

.links { display: flex; flex-direction: column; gap: 2px; }
.link {
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 0; min-height: 44px;
  text-align: left; width: 100%;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.link:hover { border-bottom-color: var(--border); }
.link-label {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  min-width: 68px; flex-shrink: 0;
}
.link-value { font-size: 15px; color: var(--text); }
.link:hover .link-value { color: var(--accent); }

.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;
}

/* --- Content ------------------------------------------------------------ */

.content { padding: 96px 0 0; min-width: 0; }

.section-title {
  font-family: var(--mono);
  font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 40px;
  padding-left: var(--entry-pad);
}

/* --- Timeline ----------------------------------------------------------- */

.timeline-section { margin-bottom: 96px; padding: var(--rail-top) 0 var(--rail-bottom); }
.timeline { position: relative; }

.track {
  position: absolute; left: var(--spine-x); top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}

.pointer {
  position: sticky; top: var(--rail-line); height: 0; z-index: 3;
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
html.js .pointer.is-visible { opacity: 1; }

.pointer-dot {
  position: absolute; left: var(--spine-x); top: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-bright);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 5px var(--bg);
}
.pointer-year {
  position: absolute; left: calc(var(--spine-x) - 18px); top: 0;
  transform: translate(-100%, -50%);
  font-family: var(--mono); font-size: 13px;
  color: var(--accent); white-space: nowrap;
}

.entries { display: flex; flex-direction: column; }

.entry {
  position: relative;
  padding: 0 0 72px var(--entry-pad);
}
.entry:last-child { padding-bottom: 24px; }

.entry::before {
  content: ''; position: absolute;
  left: var(--spine-x); top: 11px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  transform: translateX(-50%);
  transition: background-color .2s, border-color .2s;
}
html.js .entry.is-active::before {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

/* De-emphasis is done with colour, not opacity. Fading a whole entry to 0.45
   pushes its body text to ~2.9:1, and because --text-muted starts at 5.44:1,
   NO opacity below 1 keeps the bullets at AA. So the inactive state only shifts
   the company name to --text-muted (5.44:1, still AA) and hollows the dot.
   Everything on screen stays readable at all times. */
html.js .entry .entry-company { color: var(--text-muted); transition: color .25s ease; }
html.js .entry.is-active .entry-company { color: var(--text); }

.entry-period {
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em; color: var(--text-muted);
  margin-bottom: 10px;
}
.entry-company {
  font-family: var(--serif); font-size: 28px; font-weight: 400;
  line-height: 1.15; margin-bottom: 4px;
}
.entry-role {
  font-family: var(--mono); font-size: 13px;
  color: var(--text-muted); margin-bottom: 16px;
}
.entry-desc { font-size: 17px; margin-bottom: 16px; max-width: 62ch; }

.entry-points { display: flex; flex-direction: column; gap: 7px; max-width: 62ch; }
.entry-points li {
  position: relative; padding-left: 20px;
  font-size: 15px; color: var(--text-muted); line-height: 1.55;
}
.entry-points li::before {
  content: ''; position: absolute; left: 2px; top: 10px;
  width: 5px; height: 1px; background: var(--accent-bright);
}

/* Education: quieter variant, same spine anchor, no bullets, muted type. */
/* Quieter by size and by having no bullets, NOT by refusing to highlight:
   an entry that never responds to the pointer reads as broken. */
.entry--edu .entry-company { font-size: 22px; }
.entry--edu .entry-desc { font-size: 15px; color: var(--text-muted); }

/* --- Footer ------------------------------------------------------------- */

.footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 28px 32px 40px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--text-muted);
}
.footer-links { display: flex; gap: 4px; }
.footer-link {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 12px;
  font-family: var(--mono); font-size: 12px; color: var(--text-muted);
  transition: color .2s;
}
.footer-link:hover { color: var(--accent); }

html.js .entry.is-active::before { opacity: 0; }

@media (min-width: 768px) {
  :root { --rail-top: 20vh; --rail-bottom: 30vh; }
}

/* --- Tablet ------------------------------------------------------------- */

@media (max-width: 1023px) {
  .page { grid-template-columns: 1fr; gap: 0; padding: 0 24px; }
  .identity { position: static; height: auto; }
  .identity-inner { padding: 88px 0 56px; max-width: 46ch; }
  .content { padding-top: 24px; }
  .timeline-section { margin-bottom: 64px; }
  .footer { padding: 28px 24px 40px; }
}

/* --- Mobile ------------------------------------------------------------- */

@media (max-width: 767px) {
  :root { --spine-x: 18px; --entry-pad: 44px; }

  .page { padding: 0 16px; }
  .identity-inner { padding: 76px 0 48px; }

  .name { font-size: 38px; }
  .mark { font-size: 24px; margin-bottom: 22px; }
  .positioning { font-size: 16px; }
  .entry-company { font-size: 24px; }
  .entry-desc { font-size: 16px; }
  .entry { padding-bottom: 56px; }

  /* Only the year label is dropped. At 375px it collided with the entry text,
     and it is redundant there because every entry prints its period inline.
     The dot stays: it is the scroll indicator, and on the spine at 18px it
     has nothing to collide with. */
  .pointer-year { display: none; }

  .link-label { min-width: 60px; }
  .footer {
    padding: 24px 16px 32px;
    flex-direction: column; align-items: flex-start; gap: 4px;
  }
  .footer-links { margin-left: -12px; }

  /* Absolute, not fixed: a floating toggle permanently covers body text on a
     narrow screen. Here it sits at the top of the page and scrolls away. */
  .theme-toggle { position: absolute; top: 14px; right: 14px; }
}

/* --- Reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --- No JS -------------------------------------------------------------- */

html:not(.js) .pointer { display: none; }
html:not(.js) .theme-toggle { display: none; }
