/* ============================================================
   Vineet Kumar Sinha — portfolio

   Narrow viewports: a single stacked column under a compact bar.
   Desktop (≥1024px): a standing rail holds identity, the section
   index and the appearance switch while the content column
   scrolls beside it. Section labels are chapter markers — a word
   and a rule running to the margin. Dates hang outside the text
   measure. Hierarchy comes from weight and space, never elevation.
   ============================================================ */

/* ---------- 1. Tokens ------------------------------------- */

:root {
  --bg:        #ffffff;
  --ink:       #1a1a1c;
  --ink-2:     #55555a;   /* body prose            */
  --ink-3:     #6e6e73;   /* meta, dates, labels   */
  --rule:      #e3e3e6;   /* chapter rules         */
  --rule-soft: #eeeef0;   /* rules inside sections */
  --accent:    #0066cc;
  --bar:       rgba(255, 255, 255, .82);
  --sel:       rgba(0, 102, 204, .16);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue",
          Helvetica, Arial, "Noto Sans", sans-serif;

  --shell: 1280px;
  --rail:  292px;
  --pad:   clamp(1.375rem, 4.5vw, 2.5rem);

  --ease: cubic-bezier(.32, .08, .24, 1);
}

html[data-theme="dark"] {
  --bg:        #101012;
  --ink:       #ededef;
  --ink-2:     #a8a8ad;
  --ink-3:     #8e8e94;
  --rule:      #2a2a2e;
  --rule-soft: #202024;
  --accent:    #4d9fff;
  --bar:       rgba(16, 16, 18, .82);
  --sel:       rgba(77, 159, 255, .24);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #101012;      --ink: #ededef;     --ink-2: #a8a8ad;
    --ink-3: #8e8e94;   --rule: #2a2a2e;    --rule-soft: #202024;
    --accent: #4d9fff;  --bar: rgba(16, 16, 18, .82);
    --sel: rgba(77, 159, 255, .24);
  }
}

/* ---------- 2. Base -------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  letter-spacing: -.009em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

h1, h2, h3, p, ul, ol, dl, dt, dd { margin: 0; }
ul { padding: 0; list-style: none; }
svg { display: block; }
::selection { background: var(--sel); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.skip {
  position: fixed; top: -100px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 10px 18px; font-size: 14px;
  background: var(--ink); color: var(--bg); border-radius: 0 0 8px 8px;
}
.skip:focus { top: 0; text-decoration: none; }

/* ---------- 3. Appearance switch (shared) ---------------- */

.iconbtn {
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; padding: 0; background: none; cursor: pointer;
  color: var(--ink-3); border-radius: 50%;
  transition: color .2s var(--ease);
}
.iconbtn:hover { color: var(--ink); }
.iconbtn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.iconbtn .i-moon { display: none; }
html[data-theme="dark"] .iconbtn .i-moon { display: block; }
html[data-theme="dark"] .iconbtn .i-sun  { display: none; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .iconbtn .i-moon { display: block; }
  html[data-theme="auto"] .iconbtn .i-sun  { display: none; }
}

/* ---------- 4. Compact bar (narrow viewports) ------------ */

.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--rule); }

.topbar__in {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
  height: 48px;
  display: flex; align-items: center; gap: 1.25rem;
}

/* The masthead states the name already; surface it only once scrolled. */
.topbar__name {
  flex: none;
  font-size: 14px; font-weight: 500; letter-spacing: -.012em;
  color: var(--ink); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.topbar.is-scrolled .topbar__name { opacity: 1; pointer-events: auto; }
.topbar__name:hover { text-decoration: none; color: var(--ink-2); }
@media (max-width: 620px) { .topbar__name { display: none; } }

.topbar__nav {
  display: flex; align-items: center;
  gap: clamp(.8rem, 2.2vw, 1.5rem);
  margin-left: auto;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l),
                      #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l),
              #000 calc(100% - var(--fade-r)), transparent 100%);
}
.topbar__nav::-webkit-scrollbar { display: none; }

.topbar__nav a {
  font-size: 13.5px; color: var(--ink-3);
  white-space: nowrap; padding-block: 3px;
  transition: color .2s var(--ease);
}
.topbar__nav a:hover { color: var(--ink); text-decoration: none; }
.topbar__nav a[aria-current="true"] { color: var(--ink); }

/* ---------- 5. Shell ------------------------------------- */

.shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.content { padding-bottom: clamp(1.25rem, 3vw, 2rem); }

/* ---------- 6. Rail ------------------------------------- */

.rail__in {
  padding-top: clamp(2.5rem, 8vw, 4rem);
  padding-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

.rail__name {
  font-size: clamp(1.875rem, 6vw, 2.25rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.028em;
}
.rail__role {
  margin-top: .55rem;
  font-size: 16.5px;
  color: var(--ink-2);
  letter-spacing: -.011em;
}
.rail__meta {
  font-size: 16.5px;
  color: var(--ink-2);
  letter-spacing: -.011em;
}
.rail__where {
  margin-top: .7rem;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.rail__links {
  margin-top: 1.25rem;
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .3rem 0;
  font-size: 15.5px;
}
.rail__links li + li::before {
  content: "·"; color: var(--ink-3); margin-inline: .65em;
}

/* Vertical index and the switch belong to the desktop rail only. */
.railnav, .rail__foot { display: none; }

/* ---------- 7. Desktop: standing rail ------------------- */

@media (min-width: 1024px) {

  html { scroll-padding-top: 2rem; }

  .topbar { display: none; }

  .shell {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    gap: 0 clamp(3rem, 5.5vw, 5rem);
    /* Deliberately NOT align-items:start — the rail column has to
       stretch to the row height, or the sticky child runs out of
       containing block after one screen and scrolls away. */
    align-items: stretch;
  }

  .rail__in {
    position: sticky; top: 0;
    height: 100vh;
    display: flex; flex-direction: column;
    padding-block: clamp(2.75rem, 7vh, 4.5rem);
    overflow-y: auto;
  }

  .rail__name { font-size: clamp(1.5rem, 2.3vw, 1.875rem); }
  .rail__role, .rail__meta { font-size: 15.5px; }

  .rail__links {
    display: block;
    margin-top: 1.15rem;
    font-size: 15px;
  }
  .rail__links li { padding-block: .1rem; }
  .rail__links li + li::before { content: none; margin: 0; }

  /* A table of contents: one continuous rule, the current
     section's segment inked in. The indent is explained by the
     rule, so nothing looks accidentally out of alignment.      */
  .railnav {
    display: block;
    margin-top: clamp(1.75rem, 4.5vh, 3rem);
    border-left: 1px solid var(--rule);
  }
  .railnav a {
    display: block;
    padding: .3rem 0 .3rem 1rem;
    font-size: 14.5px;
    color: var(--ink-3);
    box-shadow: -1px 0 0 transparent;
    transition: color .2s var(--ease), box-shadow .2s var(--ease);
  }
  .railnav a:hover { color: var(--ink); text-decoration: none; }
  .railnav a[aria-current="true"] {
    color: var(--ink);
    box-shadow: -1px 0 0 var(--ink);
  }

  .rail__foot { display: block; margin-top: auto; padding-top: 1.75rem; }

  .content { padding-top: clamp(2.75rem, 7vh, 4.5rem); }
}

/* ---------- 8. Sections: chapter markers ---------------- */

.sec + .sec { margin-top: clamp(2.75rem, 5.5vw, 4.25rem); }

.sec__label {
  display: flex; align-items: center; gap: .95rem;
  font-size: 12px; font-weight: 600;
  letter-spacing: .095em; text-transform: uppercase;
  color: var(--ink-3);
}
.sec__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

.sec__body { margin-top: clamp(1.35rem, 2.6vw, 1.9rem); }

/* ---------- 9. Prose ------------------------------------ */

.prose {
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 68ch;
}
.prose + .prose { margin-top: 1.05em; }
.prose--lead { color: var(--ink); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 10. Entries: hanging dates ------------------ */

.entry { display: grid; gap: .2rem 0; }

.entry + .entry {
  margin-top: 1.85rem;
  padding-top: 1.85rem;
  border-top: 1px solid var(--rule-soft);
}
.entry--tight + .entry--tight { margin-top: 1.1rem; padding-top: 1.1rem; }

.entry__when {
  font-size: 13.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.entry__main { min-width: 0; }

@media (min-width: 700px) {
  .entry { grid-template-columns: 116px minmax(0, 1fr); gap: 0 1.85rem; }
  .entry__when { padding-top: .45em; }
}

.entry__title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.017em;
  color: var(--ink);
}
.entry__org {
  margin-top: .15rem;
  font-size: 15.5px;
  color: var(--ink-3);
}
.entry__foot {
  margin-top: .9rem;
  font-size: 14.5px;
  color: var(--ink-3);
}
.entry__org + .list { margin-top: .95rem; }

/* ---------- 11. Bulleted lists ------------------------- */

.list { display: grid; gap: .6rem; }
.list li {
  position: relative;
  padding-left: 1.05rem;
  font-size: 16.5px;
  line-height: 1.58;
  color: var(--ink-2);
  max-width: 70ch;
}
.list li::before {
  content: "";
  position: absolute; left: 1px; top: .68em;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* ---------- 12. Project tiles -------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
  gap: 1.9rem clamp(2rem, 4vw, 3rem);
}
.tile {
  border-top: 1px solid var(--rule-soft);
  padding-top: 1.05rem;
}
.tile__title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -.016em;
  color: var(--ink);
}
.tile__meta {
  margin-top: .12rem;
  font-size: 14px;
  color: var(--ink-3);
}
.tile .prose {
  margin-top: .7rem;
  font-size: 16px;
  line-height: 1.56;
  max-width: none;
}
.tile__stack {
  margin-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .45rem;
}
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -.005em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--rule-soft);
  color: var(--ink-2);
}

/* ---------- 13. Prestigious Recognition & Honors Cards ---------- */

.honor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.4rem;
}

.honor-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 1.35rem 1.4rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.honor-card:hover {
  border-color: var(--rule);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .honor-card:hover {
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.5);
}

.honor-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.95rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed var(--rule-soft);
}

.honor-badge__icon {
  font-size: 16px;
  line-height: 1;
}

.honor-list {
  display: grid;
  gap: 0.8rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.honor-item {
  font-size: 14.5px;
  line-height: 1.52;
  color: var(--ink-2);
  display: grid;
  gap: 0.15rem;
}

.honor-lead {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--ink);
}

.honor-lead__icon {
  font-size: 13.5px;
}

.honor-desc {
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.45;
}

.honor-subhead {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
}

.honor-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.honor-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--rule-soft);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

/* ---------- 14. Label/value rows ----------------------- */

.rows { display: grid; }
.row {
  display: grid;
  gap: .12rem 1.5rem;
  padding-block: .8rem;
  border-top: 1px solid var(--rule-soft);
}
.row:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 560px) {
  .row { grid-template-columns: 128px minmax(0, 1fr); align-items: baseline; }
}
.row dt { font-size: 14.5px; font-weight: 500; color: var(--ink-3); }
.row dd {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  min-width: 0;
  overflow-wrap: break-word;
}
.prose + .rows { margin-top: 1.45rem; }

/* ---------- 15. Footer --------------------------------- */

.foot {
  margin-top: clamp(2.75rem, 5.5vw, 4.25rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap;
  gap: .4rem 1.5rem;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-3);
}

/* ---------- 16. Motion --------------------------------- */

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

/* ---------- 18. Ambient Background Canvas -------------- */

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
}

.shell, .topbar {
  position: relative;
  z-index: 1;
}

/* ---------- 19. Telemetry HUD -------------------------- */

.hud {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--rule-soft);
  border: 1px solid var(--rule);
  margin-top: 0.9rem;
  width: fit-content;
}

.hud__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: hudPulse 2s infinite ease-in-out;
}

@keyframes hudPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.hud__sep { opacity: 0.4; }

.tile--interactive {
  position: relative;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 1.4rem;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .02);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  transform-style: preserve-3d;
  will-change: transform;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tile--interactive:hover {
  border-color: var(--rule);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .08);
}

html[data-theme="dark"] .tile--interactive:hover {
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .45);
}

.tile__glare {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  pointer-events: none;
  background: radial-gradient(360px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--sel), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.tile--interactive:hover .tile__glare {
  opacity: 1;
}

.tile--interactive > * {
  position: relative;
  z-index: 1;
}

.tile .prose {
  margin-top: .65rem;
  font-size: 15.5px;
  line-height: 1.58;
  color: var(--ink-2);
  max-width: none;
  flex: 1 0 auto;
}

/* ---------- 21. Precision Engineering Instrumentation Panels ----------- */

.inst-panel {
  margin-top: 1.2rem;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  background: #090b10;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06), 0 8px 24px -6px rgba(0, 0, 0, 0.4);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11.5px;
  color: #94a3b8;
  position: relative;
  overflow: hidden;
}

.inst-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.8;
}

.inst-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.inst-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e2e8f0;
  white-space: nowrap;
}

.inst-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  white-space: nowrap;
}

.inst-tag--alert {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.inst-tag-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: hudPulse 1.8s infinite ease-in-out;
}

/* Oscilloscope Canvas */
.oscilloscope-wrap {
  position: relative;
  background: #040508;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-block: 0.65rem;
}

.oscilloscope-canvas {
  width: 100%;
  height: 68px;
  display: block;
}

.oscilloscope-legend {
  position: absolute;
  top: 4px; right: 6px;
  display: flex;
  gap: 0.5rem;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  pointer-events: none;
}
.leg-x { color: #ff3366; }
.leg-y { color: #10b981; }
.leg-z { color: #00f0ff; }

/* Control Footer */
.inst-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

.inst-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.inst-coord {
  font-size: 11px;
  color: #cbd5e1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.inst-sub {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
}

.inst-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.inst-btn:hover {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.inst-btn:active {
  transform: translateY(0);
}

.inst-btn--pulse {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}

/* GoHotelify & AICA Custom Instrumentation */
.inst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-block: 0.65rem;
}

.inst-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
}
.inst-stat__lbl {
  font-size: 9.5px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
}
.inst-stat__val {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-top: 2px;
  display: block;
}

.inst-slider-wrap {
  margin-block: 0.65rem;
}
.inst-slider {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  accent-color: #38bdf8;
  cursor: pointer;
}

.inst-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-block: 0.6rem;
}

.inst-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd5e1;
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.inst-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.inst-chip.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.inst-console-box {
  background: #040508;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  font-size: 11px;
  line-height: 1.5;
  color: #cbd5e1;
}

/* ---------- 22. Command Palette (Cmd + K) -------------- */

.cmd-trigger {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--rule);
  padding: 7px 13px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cmd-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.cmd-trigger kbd {
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
}
html[data-theme="dark"] .cmd-trigger kbd {
  background: rgba(0, 0, 0, 0.3);
}

.cmd-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.cmd-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cmd-dialog {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  transition: transform 0.2s var(--ease);
}
.cmd-modal.is-open .cmd-dialog {
  transform: scale(1);
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  gap: 0.65rem;
}
.cmd-input-wrap svg {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
}
.cmd-input {
  flex: 1;
  background: none;
  border: 0;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  outline: none;
}

.cmd-body {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.6rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
}

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.1s ease;
}
.cmd-item:hover, .cmd-item.is-selected {
  background: var(--rule-soft);
  color: var(--ink);
}
.cmd-item kbd {
  font-size: 11px;
  color: var(--ink-3);
}

.cmd-console {
  padding: 0.6rem 0.8rem;
  background: var(--rule-soft);
  border-radius: 6px;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: none;
}
.cmd-console.is-active {
  display: block;
}

.cmd-footer {
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3);
}

/* ---------- 23. Print ---------------------------------- */

@media print {
  .topbar, .skip, .railnav, .rail__foot, .foot, #bg-canvas, .cmd-trigger, .cmd-modal { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.45; }

  .shell { display: block; max-width: none; padding: 0; }
  .rail__in {
    position: static; height: auto; padding: 0 0 1rem;
    border-bottom: 1px solid #ccc;
  }
  .rail__links { display: flex; }
  .rail__links li + li::before { content: "·"; margin-inline: .65em; }
  .content { padding: 0; }

  .sec + .sec { margin-top: 1rem; }
  .sec { page-break-inside: avoid; }
  .sec__label::after { background: #ccc; }
  .entry { grid-template-columns: 100px 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .groups { columns: 2; }

  .prose, .list li, .defs li, .row dd { color: #222; max-width: none; }
  .entry__when, .entry__org, .sec__label, .row dt, .tile__meta { color: #555; }
  .entry + .entry, .tile { border-color: #e0e0e0; }
  a { color: #000; text-decoration: none; }
  #resumeLine { display: none; }
}
