/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ---------- Tokens ----------
   Palette taken from the portrait: stone parapet, navy coat,
   oat turtleneck, autumn ochre leaves. */
:root {
  --paper: #ECE8E1;      /* stone */
  --tile: #F7F5F1;
  --ink: #1C2433;        /* navy coat */
  --ink-soft: #4A5262;
  --muted: #6B7280;
  --line: #D9D3C8;
  --oat: #E3D9C8;        /* turtleneck */
  --accent: #8F6516;     /* ochre, darkened for text contrast */
  --accent-fill: #C9962B;
  --hero-bg: #1C2433;
  --hero-fg: #F3EEE5;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-l: 28px;
  --radius-m: 20px;
  --radius-s: 999px;
  --gap: 14px;
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121822;
    --tile: #1A2230;
    --ink: #ECE6DB;
    --ink-soft: #C3BCB0;
    --muted: #97A0AD;
    --line: #2A3445;
    --oat: #2B2A26;
    --accent: #E2B451;
    --accent-fill: #C9962B;
    --hero-bg: #E3D9C8;
    --hero-fg: #1C2433;
  }
}
:root[data-theme="dark"] {
  --paper: #121822;
  --tile: #1A2230;
  --ink: #ECE6DB;
  --ink-soft: #C3BCB0;
  --muted: #97A0AD;
  --line: #2A3445;
  --oat: #2B2A26;
  --accent: #E2B451;
  --accent-fill: #C9962B;
  --hero-bg: #E3D9C8;
  --hero-fg: #1C2433;
}

/* ---------- 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: 400 17px/1.6 var(--body);
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; line-height: 1.15; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Top bar ---------- */
.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 16px 8px;
  display: flex; align-items: center; justify-content: flex-end;
}
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--tile); color: var(--ink); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

main { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---------- Bento hero ---------- */
.bento {
  display: grid;
  gap: var(--gap);
  padding: 12px 0 72px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "photo" "name" "intro" "links" "now" "stack" "langs";
}
.tile {
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 24px;
  min-width: 0;
}
.tile h2 {
  font-family: var(--body);
  font-size: 0.875rem; font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}

.tile-photo { grid-area: photo; margin: 0; padding: 0; overflow: hidden; border-radius: var(--radius-l); border: 0; aspect-ratio: 1; }
.tile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }

/* The one loud element: the name, set large on the coat-navy tile. */
.tile-name {
  grid-area: name;
  background: var(--hero-bg); color: var(--hero-fg); border: 0;
  border-radius: var(--radius-l);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 28px 28px 26px;
  min-height: 200px;
  container-type: inline-size;
}
.tile-name h1 {
  font-size: min(6.2rem, 17.5cqi);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
}
.tile-name .role { margin-top: 14px; font-size: 1.05rem; opacity: 0.82; }

.tile-intro { grid-area: intro; }
.tile-intro p { font-family: var(--display); font-size: clamp(1.2rem, 2.2vw, 1.5rem); line-height: 1.35; font-weight: 450; letter-spacing: -0.01em; max-width: 34ch; }

.tile-now { grid-area: now; background: var(--oat); border-color: transparent; }
.tile-now p { font-weight: 500; }

.tile-links { grid-area: links; }
.tile-links ul { display: grid; gap: 4px; }
.tile-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 0 -10px;
  border-radius: 12px; text-decoration: none; font-weight: 500;
  overflow-wrap: anywhere;
}
.tile-links a:hover { background: var(--paper); }
.tile-links svg { width: 18px; height: 18px; flex: none; fill: var(--accent); }

.tile-stack { grid-area: stack; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 5px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); font-size: 0.92rem; background: var(--paper);
}

.tile-langs { grid-area: langs; }

@media (min-width: 640px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      "photo name"
      "photo intro"
      "now   links"
      "stack stack"
      "langs langs";
  }
  .tile-photo { aspect-ratio: auto; min-height: 100%; }
}
@media (min-width: 960px) {
  .bento {
    padding-top: 24px;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    grid-template-areas:
      "photo name  name  name"
      "photo intro intro now"
      "links stack stack langs";
  }
}

/* ---------- Résumé: split layout ---------- */
.resume {
  display: grid;
  gap: 40px;
  padding: 56px 0 80px;
  border-top: 1px solid var(--line);
}
.resume-side h2 { font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.03em; }
.summary { margin-top: 16px; color: var(--ink-soft); max-width: 60ch; }

.print-btn {
  margin-top: 20px;
  font: 600 0.95rem var(--body);
  padding: 10px 18px; border-radius: var(--radius-s);
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  cursor: pointer;
}
.print-btn:hover { background: transparent; color: var(--ink); }

.side-block { margin-top: 32px; }
.side-block h3 { font-size: 1.1rem; margin-bottom: 10px; }
.side-block p { color: var(--ink-soft); }
.skills dt { font-weight: 600; font-size: 0.92rem; margin-top: 10px; }
.skills dt:first-child { margin-top: 0; }
.skills dd { margin: 2px 0 0; color: var(--ink-soft); }
.edu li + li { margin-top: 12px; }
.edu strong { display: block; font-weight: 600; }
.edu span { color: var(--muted); font-size: 0.95rem; }

/* Experience timeline: a real sequence, so a rail with markers. */
.timeline { position: relative; }
.timeline > li { position: relative; padding-left: 32px; padding-bottom: 44px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: 5px; top: 14px; bottom: -10px;
  width: 2px; background: var(--line);
}
.timeline > li:last-child::before { display: none; }
.timeline > li::after {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--accent-fill);
}
.timeline > li:first-child::after { background: var(--accent-fill); }

.job header { margin-bottom: 14px; }
.job h4 { font-size: 1.35rem; letter-spacing: -0.015em; }
.job .org { font-weight: 600; color: var(--accent); margin-top: 2px; }
.job .meta { color: var(--muted); font-size: 0.95rem; }
.job ul { display: grid; gap: 8px; max-width: 68ch; }
.job ul li { position: relative; padding-left: 18px; color: var(--ink-soft); }
.job ul li::before {
  content: ""; position: absolute; left: 0; top: 0.72em;
  width: 7px; height: 2px; background: var(--muted);
}

@media (min-width: 900px) {
  .resume { grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: 64px; }
  .resume-side { position: sticky; top: 24px; align-self: start; }
  .resume-main { padding-top: 10px; }
}

/* ---------- Footer ---------- */
.footer {
  max-width: var(--max); margin: 0 auto; padding: 24px 16px 40px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem;
}

/* ---------- Load moment: one orchestrated reveal of the bento ---------- */
@media (prefers-reduced-motion: no-preference) {
  .bento > .tile { animation: rise 0.6s cubic-bezier(.2,.7,.2,1) both; }
  .bento > .tile:nth-child(2) { animation-delay: 60ms; }
  .bento > .tile:nth-child(3) { animation-delay: 120ms; }
  .bento > .tile:nth-child(4) { animation-delay: 180ms; }
  .bento > .tile:nth-child(5) { animation-delay: 220ms; }
  .bento > .tile:nth-child(6) { animation-delay: 260ms; }
  .bento > .tile:nth-child(7) { animation-delay: 300ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
}

/* ---------- Print: a clean one-column résumé ---------- */
@media print {
  @page { size: A4; margin: 12mm 14mm; }
  :root { --paper: #fff; --tile: #fff; --ink: #111; --ink-soft: #333; --muted: #555; --line: #ccc; --accent: #6b4a0e; --accent-fill: #6b4a0e; }
  html { font-size: 9.5pt; }
  body { font-size: 1rem; line-height: 1.35; background: #fff; }
  .topbar, .print-btn, .footer, .tile-photo, .tile-intro, .tile-now, .tile-stack, .tile-langs, .theme-toggle { display: none !important; }
  main { max-width: none; padding: 0; }
  .bento { display: block; padding: 0 0 6pt; }
  .bento > .tile { animation: none; }
  .tile { border: 0; padding: 0; background: none; }
  .tile-name { background: none; color: #111; min-height: 0; padding: 0; }
  .tile-name h1 { font-size: 22pt; letter-spacing: -0.03em; }
  .tile-name .role { margin-top: 2pt; opacity: 1; }
  .tile-links { margin-top: 4pt; }
  .tile-links h2 { display: none; }
  .tile-links ul { display: flex; flex-wrap: wrap; gap: 4pt 16pt; }
  .tile-links li:last-child { display: none; }
  .tile-links a { margin: 0; padding: 0; }
  .tile-links svg { width: 11pt; height: 11pt; }
  .tile-links a[href^="https://www.linkedin"]::after { content: " (linkedin.com/in/himanshoo-sharma)"; color: #555; }
  .resume { display: block; border-top: 1px solid #ccc; padding: 8pt 0 0; }
  .resume-side { position: static; }
  .resume-side h2 { display: none; }
  .summary { margin: 0 0 8pt; color: #222; max-width: none; }
  .resume-main { padding: 0; }
  .timeline > li { padding-left: 0; padding-bottom: 8pt; break-inside: avoid; }
  .timeline > li::before, .timeline > li::after { display: none; }
  .job h4 { font-size: 11pt; }
  .job header { margin-bottom: 3pt; }
  .job ul { gap: 1pt; max-width: none; }
  .side-block { margin-top: 10pt; break-inside: avoid; }
  /* On paper: summary, then experience, then skills/education/languages. */
  .resume { display: flex; flex-flow: row wrap; gap: 6pt 18pt; }
  .resume-side { display: contents; }
  .summary { order: 0; flex: 1 1 100%; }
  .resume-main { order: 1; flex: 1 1 100%; }
  .side-block { order: 2; flex: 1 1 0; margin-top: 4pt; }
  .side-block h3 { font-size: 10pt; margin-bottom: 3pt; }
  .skills dt { margin-top: 2pt; }
  .tile-links a[href*="git.himanshoo.com"]::after { content: " (git.himanshoo.com)"; color: #555; }
}
