/* ==========================================================
   Nishant Vibhute | site styles
   ========================================================== */

:root {
  /* Colour */
  --paper: #f6f4ef;
  --paper-2: #ece8df;
  --ink: #1c1b18;
  --ink-2: #47443d;
  --ink-3: #6f6a60;
  --rule: #d9d3c6;
  --accent: #1f4d3a;
  --accent-dark: #163a2b;
  --on-accent: #ffffff;

  /* Type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  /* Layout */
  /* Sizes in rem grow with the text on large screens (see html below). */
  --aside: 21rem;
  --measure: 44rem;
  --radius: 3px;
  color-scheme: light;
}

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

html {
  /* 16px up to laptop size, growing smoothly to 20px on very large monitors. */
  font-size: clamp(1rem, 0.36vw + 0.69rem, 1.25rem);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-dark); text-decoration-thickness: 2px; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }

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

.label {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Page layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--aside) minmax(0, 1fr);
  max-width: 84rem;
  min-height: 100vh;
  margin: 0 auto;
}

/* ---------- Sidebar ---------- */
.aside {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 2.75rem 2rem 1.75rem;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  scrollbar-width: none;
}
.aside::-webkit-scrollbar { display: none; }

.portrait {
  width: 6.5rem;
  height: 6.5rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
  transition: filter .3s ease;
}
.portrait:hover { filter: none; }

.aside h1 {
  margin: 20px 0 8px;
  font-family: var(--serif);
  font-size: 1.95rem;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.012em;
}
.role {
  color: var(--ink-2);
  font-size: .9rem;
  line-height: 1.45;
}
/* Each phrase stays whole; lines only break between phrases. */
.role span { white-space: nowrap; }
.role + .role { margin-top: 4px; }

.toc {
  margin-top: 28px;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  color: var(--ink-3);
  font-size: .9rem;
  text-decoration: none;
  transition: color .15s ease;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  width: 20px;
  font-family: var(--mono);
  font-size: .7rem;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); font-weight: 500; }
.toc a.active::before { color: var(--accent); }

.aside-foot { margin-top: auto; padding-top: 24px; }
.links {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 0;
  list-style: none;
}
.links a, .links span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: .86rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.links a:hover { color: var(--accent); }
.links i { width: 16px; font-size: .95rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.aside .btn { width: 100%; }

/* ---------- Main column ---------- */
.main { min-width: 0; padding: 44px 64px 32px; }

.intro { padding: 12px 0 56px; border-bottom: 1px solid var(--rule); }
.statement {
  max-width: 20em;
  margin-top: 16px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.statement em { color: var(--accent); }

.sec {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 32px;
  padding: 56px 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 0;
}
.sec:last-of-type { border-bottom: 0; }
.num {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .76rem;
}
.sec-label h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.sec-body { min-width: 0; max-width: var(--measure); }
.sec-body > p { margin-bottom: 16px; color: var(--ink-2); }
.sec-body > p:last-child { margin-bottom: 0; }
.sec-body > p.lead-text {
  margin-bottom: 20px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.5;
}
.rows.glance { margin-top: 28px; }
.subhead { margin: 40px 0 16px; }

/* ---------- Ruled lists (subjects, resources, skills) ---------- */
.rows { padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.rows > li, .rows > div {
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.subjects { margin: 20px 0 32px; }
.subjects li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
}
.subjects b { font-weight: 500; white-space: nowrap; }
.subjects span { color: var(--ink-3); font-size: .88rem; text-align: right; }

.office {
  padding: 26px 28px;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
}
.office h3 {
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 500;
}
.office p { margin-bottom: 16px; color: var(--ink-2); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* Resources: folders and files */
.folder-list { margin: 8px 0 24px; }
.folder-list > li { padding: 0; }
.folder-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 8px 0;
  color: var(--ink);
  text-decoration: none;
}
.folder-row > .bi-folder2 { color: var(--accent); font-size: 1.1rem; }
.folder-name { font-weight: 500; }
.folder-row .kind { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.folder-row .go-icon { color: var(--ink-3); font-size: .8rem; transition: transform .15s ease, color .15s ease; }
.folder-row:hover { color: var(--accent); text-decoration: none; }
.folder-row:hover .go-icon { color: var(--accent); transform: translateX(3px); }
.file-list { margin: 8px 0 0; }
.file a i { margin-right: 6px; color: var(--ink-3); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 32px;
  color: var(--ink-3);
  font-size: .88rem;
}
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; }
.article .rows { color: var(--ink); }
.file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
}
.file a { color: var(--ink); text-decoration: none; }
.file a:hover { color: var(--accent); text-decoration: underline; }
.file .kind { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.file.empty { color: var(--ink-3); font-size: .92rem; }

/* ---------- Dated entries (experience, education, certifications, blog) ---------- */
.entry {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 30px;
}
.entry:last-child { padding-bottom: 0; }
.when {
  padding-top: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.entry h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.org { margin: 1px 0 8px; color: var(--accent); font-size: .93rem; }
.entry .org:last-child { margin-bottom: 0; }
.entry ul { padding-left: 18px; color: var(--ink-2); }
.entry li { margin-bottom: 4px; }
.entry li::marker { color: var(--ink-3); }
/* Expandable entry (teaching inside Experience) */
.more > summary {
  display: block;
  list-style: none;
  cursor: pointer;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover h3 { color: var(--accent); }
.more-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 500;
}
.more-hint i { font-size: .8rem; transition: transform .2s ease; }
.more .when-open, .more[open] .when-closed { display: none; }
.more[open] .when-open { display: inline; }
.more[open] .more-hint i { transform: rotate(180deg); }
.more-body { margin-top: 16px; }
.more-body > p { color: var(--ink-2); }
.more-body .subjects { margin: 12px 0 24px; padding-left: 0; color: var(--ink); }
.more-body .subjects li { margin-bottom: 0; }

.entry-link { color: var(--ink); font-weight: 500; text-decoration: none; }
.entry-link:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Projects ---------- */
.projects { border-top: 1px solid var(--rule); }
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  width: 100%;
  padding: 20px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.project .kind { display: block; margin-bottom: 4px; }
.project h3 {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 500;
  line-height: 1.25;
}
.project p { margin-top: 2px; color: var(--ink-2); font-size: .94rem; line-height: 1.5; }
.project .go {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-2);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.project:hover h3 { color: var(--accent); }
.project:hover .go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Skills ---------- */
.skill-row {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 16px;
}
.skill-row dt {
  padding-top: 3px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- Contact ---------- */
.contact-line {
  margin-bottom: 20px;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.38;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: .82rem;
}

/* ---------- Project dialog ---------- */
dialog.proj-dialog {
  width: min(880px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
}
dialog.proj-dialog::backdrop { background: rgba(28, 27, 24, .6); }
.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
}
.dlg-head h3 { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; line-height: 1.25; }
.dlg-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
}
.dlg-close:hover { background: var(--ink); color: var(--paper); }
.dlg-body { padding: 24px; }
.dlg-main { background: var(--paper-2); border: 1px solid var(--rule); }
.dlg-main img { width: 100%; max-height: 440px; object-fit: contain; }
.dlg-thumbs { display: flex; gap: 10px; margin: 12px 0 20px; }
.dlg-thumbs button {
  flex: 1;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  opacity: .6;
  cursor: pointer;
}
.dlg-thumbs button.on { border-color: var(--accent); outline: 1px solid var(--accent); opacity: 1; }
.dlg-thumbs img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.dlg-body p { margin-bottom: 14px; color: var(--ink-2); }
.dlg-body ul { padding-left: 18px; color: var(--ink-2); }

/* ---------- Blog post page ---------- */
.article-wrap { max-width: var(--measure); margin: 0 auto; padding: 44px 16px 32px; }
.article-wrap .back { display: inline-block; margin-bottom: 36px; font-size: .9rem; }
.article h1 {
  margin: 10px 0 24px;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -.015em;
}
.article h2 { margin: 32px 0 10px; font-family: var(--serif); font-size: 1.4rem; font-weight: 500; }
.article p, .article ul, .article ol { margin-bottom: 16px; color: var(--ink-2); }
.article img { margin: 24px 0; border: 1px solid var(--rule); }
.article-wrap .footer { margin-top: 48px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .main { padding: 40px; }
  .sec { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* Tablets and phones: compact header, then a menu that stays at the top while scrolling */
@media (max-width: 860px) {
  html { scroll-padding-top: 60px; }

  .layout { display: flex; flex-direction: column; }
  .aside { display: contents; }

  .id {
    order: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 16px 0;
  }
  .portrait { flex: none; width: 72px; height: 72px; }
  .aside h1 { margin: 0 0 4px; font-size: 1.65rem; }
  .role { font-size: .88rem; }

  .aside-foot {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 24px;
    margin-top: 0;
    padding: 12px 16px 20px;
  }
  .links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; }
  .links a, .links span { min-height: 44px; }
  .aside .btn { width: auto; }

  .site-nav {
    order: 3;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }
  .toc {
    display: flex;
    margin: 0;
    padding: 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a {
    align-items: center;
    min-height: 48px;
    padding: 0 10px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .toc a::before { display: none; }
  .toc a.active { border-bottom-color: var(--accent); }

  .main { order: 4; padding: 0 16px 28px; }
  .intro { padding: 32px 0 40px; }
  .sec { padding: 40px 0; }

  /* Finger-sized tap targets */
  .btn { min-height: 44px; }
  .rows > li.file { padding: 2px 0; }
  .rows > li.file.empty { padding: 12px 0; }
  .file a, .entry-link { display: block; padding: 10px 0; }

  /* Small print a little larger on small screens */
  .label, .file .kind, .when, .num { font-size: .78rem; }
  .skill-row dt { font-size: .76rem; }
}

@media (max-width: 560px) {
  .aside .btn { width: 100%; }
  dialog.proj-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .dlg-head { padding: 12px 16px; }
  .dlg-head h3 { font-size: 1.15rem; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-bottom: 24px; }
  .when { padding-top: 0; }
  .skill-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .subjects li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .subjects span { text-align: left; }
  .project { gap: 14px; }
  .project h3 { font-size: 1.14rem; }
  .office { padding: 22px 18px; }
  .dlg-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Print: clean one-column copy ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .layout { display: block; }
  .aside { position: static; height: auto; border: 0; padding: 0 0 12pt; }
  .toc, .btn, .btns, .go { display: none; }
  .portrait { filter: none; }
  .main { padding: 0; }
  .sec { display: block; padding: 14pt 0; break-inside: avoid; }
}
