/* =============================================================
   SUBTEXT MFA 2026 — Global Styles
   ============================================================= */

/* =============================================================
   FONT FACES
   ============================================================= */

/* Polymath Display — Main Headline */
@font-face {
  font-family: 'Polymath Display';
  src: url('polymath-font-family/PolymathDispDemo-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath Display';
  src: url('polymath-font-family/PolymathDispDemo-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath Display';
  src: url('polymath-font-family/PolymathDispDemo-BoldIt.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath Display';
  src: url('polymath-font-family/PolymathDispDemo-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Degular — Sub Headline, Body, Secondary Headline */
@font-face {
  font-family: 'Degular';
  src: url('degular-font-family/DegularDemo-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Degular';
  src: url('degular-font-family/DegularDemo-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Degular';
  src: url('degular-font-family/DegularDemo-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Degular';
  src: url('degular-font-family/DegularDemo-Semibold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Degular';
  src: url('degular-font-family/DegularDemo-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Degular Text — Secondary Body */
@font-face {
  font-family: 'Degular Text';
  src: url('degular-font-family/DegularTextDemo-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Degular Text';
  src: url('degular-font-family/DegularTextDemo-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Degular Text';
  src: url('degular-font-family/DegularTextDemo-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Degular Text';
  src: url('degular-font-family/DegularTextDemo-Semibold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:   #ABB7FA;
  --yellow: #FAF250;
  --black:  #000000;
  --white:  #ffffff;
  --grey-light: #f2f2f2;
  --grey-mid:   #e0e0e0;
  --grey-dark:  #888888;
  --text-secondary: #333333;
  /* Brand type hierarchy (per brand guidelines) */
  --font-logo:      'Red Hat Display', 'Helvetica Neue', Arial, sans-serif;   /* logo & chrome only */
  --font-headline:  'Polymath Display', 'Helvetica Neue', Arial, sans-serif;  /* main headlines */
  --font-ui:        'Degular', 'Helvetica Neue', Arial, sans-serif;           /* sub-headlines, nav, labels */
  --font-body:      'Degular Text', 'Helvetica Neue', Arial, sans-serif;      /* body copy */
  /* Legacy aliases — kept so existing rules still compile */
  --font-display:   var(--font-logo);
  --font-subhead:   var(--font-ui);
  --b: 1px solid var(--black);   /* universal border shorthand */
  --tree-width: 320px;
  --tree-collapsed-width: 18px;
  --chrome-h: 56px;
  --transition: 0.22s ease;
  --logo-letter-fill: #000000;
  --logo-bubble-fill: #FAF250;
}

[data-theme="dark"] {
  --logo-letter-fill: #000000;
  --logo-bubble-fill: #ABB7FA;
  --black:       #000000;
  --white:       #FAF250;
  --grey-light:  #f0e840;
  --grey-mid:    #e8e030;
  --grey-dark:   #888800;
  --text-secondary: #333300;
  --b: 1px solid var(--black);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--blue);
  font-family: var(--font-body);
  color: var(--black);
}

html {
  font-size: 14px;
}

/* Font size scaling affects everything, scales from center */
#desktop.font-small {
  transform: scale(0.9);
  transform-origin: center center;
}

#desktop.font-large {
  transform: scale(1.1);
  transform-origin: center center;
}

/* =============================================================
   DESKTOP SHELL
   ============================================================= */
#desktop {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 0;
}

#main-window {
  width: 100%;
  height: 100%;
  max-width: 1440px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  border: var(--b);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

/* --- Window Chrome ----------------------------------------- */
#window-chrome {
  height: 36px;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  flex-shrink: 0;
  user-select: none;
}

#chrome-title {
  font-family: var(--font-logo);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--white);
  text-transform: uppercase;
}

/* --- Content Row ------------------------------------------- */
#content-row {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* --- Content Area ------------------------------------------ */
#content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* --- Content Header ---------------------------------------- */
#content-header {
  height: var(--chrome-h);
  border-bottom: var(--b);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 10px;
  flex-shrink: 0;
  background: var(--white);
}

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
}

/* Only the root segment (MFA 2026) is bold */
.breadcrumb-seg {
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 15px;
}
.breadcrumb-seg.root {
  font-family: var(--font-logo);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.breadcrumb-seg:hover { text-decoration: underline; }
.breadcrumb-seg.active { cursor: default; }
.breadcrumb-seg.active:hover { text-decoration: none; }

.breadcrumb-arrow {
  color: var(--grey-dark);
  font-size: 13px;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 400;
}

/* Mobile tree toggle — hidden on desktop */
#mobile-tree-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--black);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

/* --- Content Scroll ---------------------------------------- */
#content-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 24px;
}

/* =============================================================
   MASONRY GRID
   ============================================================= */
.masonry-grid {
  columns: 4;
  column-gap: 12px;
}
@media (max-width: 1100px) { .masonry-grid { columns: 3; } }
@media (max-width: 750px)  { .masonry-grid { columns: 2; } }
@media (max-width: 420px)  { .masonry-grid { columns: 1; } }

.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  cursor: pointer;
  overflow: hidden;
  background: var(--grey-light);
  border: 3px solid transparent;
  transition: border-color var(--transition);
  display: block;
}
.masonry-item:hover { border-color: var(--black); }
.masonry-item img { width: 100%; display: block; }
.masonry-item .item-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  background: var(--white);
  border-top: var(--b);
}

/* =============================================================
   STUDENT DETAIL
   ============================================================= */
.student-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: var(--b);
}
.student-header h1 {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 32px;
  margin-bottom: 10px;
}
.student-header p {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  max-width: 640px;
  color: var(--text-secondary);
}
.view-page-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 18px;
  background: var(--yellow);
  border: var(--b);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--black);
  cursor: pointer;
  transition: background var(--transition);
}
.view-page-btn:hover { background: var(--blue); }

.project-section { margin-bottom: 36px; }

@media (max-width: 768px) {
  .project-section:first-child {
    padding-top: 20px;
  }
}

/* Project title row — title + (i) button */
.project-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: none;
  padding-bottom: 4px;
}
.project-title-row .project-title {
  margin-bottom: 0;
  padding-bottom: 0.1em;
  border-bottom: none;
  flex: 1;
  /* Keep inline so highlight renders per-line */
}
.project-info-btn {
  background: none;
  border: none;
  padding: 0 0 0 5px;
  cursor: pointer;
  color: var(--black);
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity 0.15s;
  position: relative;
  top: -1px; /* optical alignment with title baseline */
}
.project-info-btn:hover { opacity: 0.6; }

/* Info popup overlay */
#info-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}
#info-popup.open {
  display: flex;
  animation: popup-fade-in 0.18s ease;
}
@keyframes popup-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#info-popup-card {
  background: #ffffff;
  border: var(--b);
  border-radius: 0;
  padding: 0;
  position: relative;
  box-shadow: 0 12px 56px rgba(0,0,0,0.22);
  width: clamp(340px, 80vw, 900px);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#info-popup-card-inner {
  width: 100%;
  padding: 32px 36px 36px;
  box-sizing: border-box;
  overflow-y: auto;
}
#info-popup-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--black);
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s;
  z-index: 10;
}
#info-popup-close:hover { opacity: 1; }
#info-popup-title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--black);
  margin: 0 0 20px 0;
  padding: 0;
  border: none;
  text-align: left;
}
.info-popup-body-wrap {
  line-height: 1.7;
}
#info-popup-body {
  font-family: var(--font-body);
  font-size: clamp(20px, 2.8vw, 32px);
  line-height: inherit;
  color: var(--black);
  /* Highlighter: yellow slab behind text, clones per line via box-decoration-break */
  background: #FAF250;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.12em 0.3em;
  display: inline;
}
.project-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  border-bottom: none;
  display: inline;
  background: #FAF250;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.1em 0.25em;
  line-height: 1.6;
}
@media (max-width: 900px) {
  .project-title,
  .project-title-row .project-title {
    font-size: 20px !important;
    letter-spacing: 0.04em;
    padding-bottom: 8px;
    margin-bottom: 14px;
  }
}

/* =============================================================
   BIO STAGE + WALL TEXT BACKGROUND
   ============================================================= */
.bio-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile bio wall text — hidden on desktop */
.bio-wall-statement {
  display: none;
}
@media (max-width: 768px) {
  .bio-wall-statement { display: block; }
}
@media (max-width: 768px) {
  /* Wall-text bio statement — full width, word per line, JS-sized */
  .bio-wall-statement {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px 24px;
    overflow: visible; /* never clip — panel handles scroll if needed */
    z-index: 1;
    font-family: var(--font-headline);
    font-weight: 700;
    color: var(--black);
    pointer-events: none;
    user-select: none;
    margin: 0;
  }
  .bio-wall-line {
    display: block;
    width: 100%;
    text-align: justify;
    text-align-last: left; /* overridden per-line by JS */
    white-space: nowrap;
    overflow: hidden;
  }
}

.bio-bg-text {
  font-size: 8vw;
}

/* =============================================================
   BIO CARD (Student Fork / Portal Page)
   ============================================================= */
.bio-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 28px;
  padding: 32px 24px;
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

/* Mid — tablet: mirrors mobile layout with slightly more room */
@media (min-width: 769px) and (max-width: 1099px) {
  .bio-tab-panel:has(.bio-card) {
    display: block;
    overflow-y: auto;
    padding: 0 0 32px;
  }
  .bio-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 16px 24px 24px;
    max-width: 100%;
    min-height: unset;
    height: auto;
  }
  .bio-name-rail {
    display: none;
  }
  .bio-portrait {
    width: min(52vw, 38dvh, 340px);
    height: min(52vw, 38dvh, 340px);
    flex-shrink: 0;
  }
  .bio-statement {
    max-width: 560px;
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.25;
    text-align: justify;
  }
  .bio-info {
    align-items: center;
  }
  .bio-btn-group {
    display: none !important;
  }
  .bio-name-rail {
    display: none !important;
  }
  .bio-mid-statement {
    padding: 24px 32px calc(40px + env(safe-area-inset-bottom, 0px));
    max-width: 680px;
    margin: 0 auto;
  }
  .bio-mid-statement .bio-statement {
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.4;
    text-align: justify;
    max-width: 100%;
  }
}

/* Wide desktop — portrait sits beside text, name rail on far right */
@media (min-width: 1100px) {
  .bio-card {
    flex-direction: row;
    align-items: stretch;
    text-align: left;
    gap: 48px;
    padding: 48px 40px;
    max-width: 1000px;
  }
  .bio-name-rail {
    /* Override any mid-range reset — back to vertical on desktop */
    order: unset;
    width: auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding-right: 0;
    padding-bottom: 0;
  }
  .bio-name {
    writing-mode: vertical-rl;
    white-space: nowrap;
    font-size: clamp(48px, 6vw, 96px);
    text-align: unset;
  }
  .bio-info {
    align-items: flex-start;
  }
  .bio-btn-group {
    align-self: flex-start;
  }
}

.bio-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  flex: 1;
}

/* Portrait — draggable circle */
.bio-portrait {
  width: clamp(260px, 22vw, 400px);
  height: clamp(260px, 22vw, 400px);
  border-radius: 50%;
  background: var(--white);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  will-change: transform;
  position: relative;
  z-index: 5;
  /* Inset stroke drawn on top of image, matching portal bubbles */
  box-shadow: inset 0 0 0 1px var(--black);
}
.bio-portrait.dragging {
  cursor: grabbing;
}
.bio-portrait img {
  width: 145%;
  height: 145%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
  border-radius: 0;
  margin: -22.5%;
}

/* Info column — always below portrait */

/* Right-edge vertical name rail */
.bio-name-rail {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  align-self: stretch;
  flex-shrink: 0;
  padding-right: 4px;
}

.bio-name {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--black);
  white-space: nowrap;
  /* Clockwise = top-to-bottom: writing-mode vertical-rl, no rotation */
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.bio-statement {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
  max-width: 520px;
  color: var(--text-secondary);
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  margin: 0;
}

/* Shared container — both button rows sit inside this, widths lock together */
.bio-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-self: center;
  width: 100%;
}

/* Primary nav buttons: SUBTEXT / WORK */
.bio-primary-btns {
  display: flex;
  flex-direction: row;
}

.bio-btn-primary {
  flex: 1;
  height: 52px;
  padding: 0 28px;
  border: var(--b);
  border-radius: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--white);
  color: var(--black);
  transition: background var(--transition), color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  line-height: 1;
}
/* Adjacent primary buttons share the middle border */
.bio-btn-primary + .bio-btn-primary {
  margin-left: -3px;
}
/* Primary row sits flush on top of secondary row */
.bio-primary-btns + .bio-secondary-btns {
  margin-top: -3px;
}
/* Subtext button gets yellow bg */
.bio-btn-primary.bio-btn-subtext {
  background: var(--white);
}
.bio-btn-primary:hover {
  background: var(--black);
  color: var(--white);
  z-index: 1;
  position: relative;
}

/* Secondary link buttons: Portfolio / Instagram / Contact */
.bio-secondary-btns {
  display: flex;
  flex-direction: row;
}

.bio-btn-secondary {
  flex: 1;
  height: 42px;
  padding: 0 20px;
  border: var(--b);
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
/* Adjacent secondary buttons share the middle border */
.bio-btn-secondary + .bio-btn-secondary {
  margin-left: -3px;
}
.bio-btn-secondary:hover {
  background: var(--blue);
  color: var(--black);
  z-index: 1;
  position: relative;
}

/* Info popup Visit Site button */
#info-popup-visit {
  display: inline-block;
  margin-top: 24px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  text-decoration: none;
  border: var(--b);
  padding: 8px 18px;
  transition: background 0.15s, color 0.15s;
}
#info-popup-visit:hover {
  background: #ABB7FA;
}

/* Contact tab */
.contact-tab-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 40px 24px;
  box-sizing: border-box;
}
.contact-btn-group {
  flex-direction: column !important;
  width: min(380px, 90%);
  gap: 0;
}
.contact-btn-group .bio-btn-secondary {
  flex: none;
  width: 100%;
  height: 56px;
  font-size: 13px;
  letter-spacing: 0.12em;
  margin-left: 0 !important;
  margin-top: -3px;
  justify-content: center;
}
.contact-btn-group .bio-btn-secondary:first-child {
  margin-top: 0;
}

/* Empty state message */
.empty-state {
  padding: 40px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--grey-dark);
}
.empty-state strong {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--black);
}

.subtext-statement {
  padding: 0;
  max-width: 720px;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .subtext-statement {
    padding: 20px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  }
}
/* When an artifact image is present — side-by-side layout on desktop,
   stacked on mobile */
.subtext-statement.has-artifact {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px;
  max-width: 1100px;
  box-sizing: border-box;
}
.subtext-artifact-wrap {
  flex: 0 0 auto;
  width: clamp(200px, 35vw, 480px);
  max-width: 45%;
}
.subtext-artifact {
  width: 100%;
  height: auto;
  display: block;
  border: var(--b);
  max-height: calc(100vh - 220px);
  object-fit: contain;
}
.subtext-text-wrap {
  flex: 1 1 auto;
  min-width: 0;
}
@media (max-width: 768px) {
  .subtext-statement {
    padding: 20px 16px calc(60px + env(safe-area-inset-bottom, 0px)) 16px;
  }
  .subtext-statement.has-artifact {
    flex-direction: column;
    gap: 20px;
    padding: 20px 16px calc(60px + env(safe-area-inset-bottom, 0px)) 16px;
  }
  .subtext-artifact-wrap {
    width: 100%;
    max-width: 100%;
  }
  .subtext-artifact {
    max-height: none;
    width: 100%;
    height: auto;
  }
}
.subtext-title {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--black);
  margin: 0 0 20px;
  /* Highlighter treatment — same as info popup */
  display: inline;
  background: #FAF250;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.1em 0.25em;
  line-height: 1.5;
}
/* Wrapper needed so the inline title behaves as a block element */
.subtext-title-wrap {
  display: block;
  margin: 0 0 20px;
}
.subtext-body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}

/* =============================================================
   BIO TAB BAR + PANEL
   ============================================================= */
.bio-tab-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row;
  z-index: 10;
  border-bottom: var(--b);
  background: var(--white);
}

.bio-tab-btn {
  flex: 1;
  height: var(--chrome-h);
  border: none;
  border-right: var(--b);
  background: var(--white);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--black);
  transition: background var(--transition), color var(--transition);
}
.bio-tab-btn:last-child { border-right: none; }
.bio-tab-btn:hover { background: #ABB7FA; color: var(--black); }
.bio-tab-btn.active {
  background: #FAF250;
  color: var(--black);
  cursor: default;
}

/* Scrollable content sits below the tab bar */
.bio-tab-panel {
  position: absolute;
  top: var(--chrome-h);
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 24px;
}
/* Subtext tab - no scroll on desktop, scrollable on mobile */
.bio-tab-panel:has(.subtext-statement) {
  overflow-y: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
@media (max-width: 768px) {
  .bio-tab-panel:has(.subtext-statement) {
    overflow-y: auto;
    display: block;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}
/* Work tab needs standard scroll padding; Bio tab content is centered */
.bio-tab-panel:has(.bio-card) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

@media (max-width: 768px) {
  /* Safe-area bottom padding — clears Android/iOS browser chrome.
     20px covers the visible bleed; env() adds device inset on top. */
  .bio-tab-panel {
    padding: 6px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* Bio tab on mobile: simple block, statement flows from top */
  .bio-tab-panel:has(.bio-card) {
    padding: 0 0 calc(60px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    display: block;
  }

  /* Portrait floats on the stage above the statement */
  .bio-portrait-mobile {
    position: absolute;
    top: 8vw;
    left: 50%;
    transform: translateX(-50%);
    width:  min(52vw, 220px);
    height: min(52vw, 220px);
    z-index: 5;
    flex-shrink: 0;
  }

  .bio-tab-btn { font-size: 11px; letter-spacing: 0.08em; }
}

/* Portrait float animation — 4 variants for randomized feel */
@keyframes portrait-float-a {
  0%   { transform: translateY(0px)   translateX(0px); }
  30%  { transform: translateY(-9px)  translateX(3px); }
  60%  { transform: translateY(-4px)  translateX(-4px); }
  100% { transform: translateY(0px)   translateX(0px); }
}
@keyframes portrait-float-b {
  0%   { transform: translateY(0px)   translateX(0px); }
  25%  { transform: translateY(-6px)  translateX(-3px); }
  65%  { transform: translateY(-11px) translateX(2px); }
  100% { transform: translateY(0px)   translateX(0px); }
}
@keyframes portrait-float-c {
  0%   { transform: translateY(0px)   translateX(0px); }
  40%  { transform: translateY(-7px)  translateX(4px); }
  70%  { transform: translateY(-3px)  translateX(-2px); }
  100% { transform: translateY(0px)   translateX(0px); }
}
@keyframes portrait-float-d {
  0%   { transform: translateY(0px)   translateX(0px); }
  35%  { transform: translateY(-10px) translateX(-3px); }
  55%  { transform: translateY(-5px)  translateX(3px); }
  100% { transform: translateY(0px)   translateX(0px); }
}
.portrait-float-a { animation: portrait-float-a 7.0s ease-in-out infinite; }
.portrait-float-b { animation: portrait-float-b 8.5s ease-in-out infinite; }
.portrait-float-c { animation: portrait-float-c 6.5s ease-in-out infinite; }
.portrait-float-d { animation: portrait-float-d 9.0s ease-in-out infinite; }

/* Bio card responsive */
@media (max-width: 768px) {
  .bio-card {
    padding: 4px 14px 10px;
    gap: 6px;
    max-width: 100%;
    flex-direction: column;
    align-items: center;
    min-height: unset;
    height: auto;
  }
  /* On mobile hide the name rail — name is injected into the statement text instead */
  .bio-name-rail {
    display: none;
  }
  .bio-portrait {
    width: min(72vw, 35dvh, 320px);
    height: min(72vw, 35dvh, 320px);
    flex-shrink: 0;
  }
  .bio-statement {
    max-width: 100%;
    font-size: clamp(14px, 3.5vw, 16px);
    line-height: 1.25;
    text-align: justify;
  }
}

/* iPhone SE and other narrow phones (≤ 390px) */
@media (max-width: 390px) {
  .bio-card {
    padding: 4px 10px 8px;
    gap: 6px;
  }
  /* dvh already handles portrait sizing — no override needed */
  .bio-name {
    font-size: 22px;
  }
  .bio-statement {
    font-size: clamp(13px, 3.5vw, 15px);
    line-height: 1.2;
  }
}

/* =============================================================
   STUDENTS PORTAL
   ============================================================= */
.portal-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--white);
}

/* Background statement text — large, centered, low opacity */
.portal-bg-text {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 10vw;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-align: justify;
  text-align-last: justify;
  word-spacing: 0.1em;
  color: var(--black);
  opacity: 0.13;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  overflow: hidden;
  padding: 0;
}
/* Bio page override — must come after .portal-bg-text to win cascade */
.bio-bg-text { opacity: 1; color: rgba(0,0,0,0.07); }

/* Background text control states */
#desktop.bg-text-off .portal-bg-text {
  display: none;
}
#desktop.bg-text-stroke .portal-bg-text {
  color: transparent;
  -webkit-text-stroke: 1px var(--black);
  text-stroke: 1px var(--black);
  opacity: 0.3;
}
#desktop.bg-text-stroke .bio-bg-text {
  color: transparent;
  -webkit-text-stroke: 1px rgba(0,0,0,0.18);
  text-stroke: 1px rgba(0,0,0,0.18);
}
.portal-bg-line {
  display: block;
  width: 100%;
  text-align: justify;
  text-align-last: justify;
  white-space: nowrap;
  overflow: hidden;
}

/* Each portrait bubble */
.portal-bubble {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  border: none;
  outline: none;
  background: var(--grey-light);
  will-change: transform;
  padding: 0;
  /* Inset shadow draws the border ON TOP of the image, masking the gap */
  box-shadow: inset 0 0 0 1px var(--black);
}
.portal-bubble img {
  width: 145%;
  height: 145%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
  border-radius: 0;
  margin: -22.5%;
  padding: 0;
}
.portal-bubble-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--black);
  pointer-events: none;
}

/* Name label — appears below bubble on hover */
.portal-bubble-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.portal-bubble:hover .portal-bubble-label { opacity: 1; }
.portal-bubble:hover {
  box-shadow: inset 0 0 0 1px var(--blue);
  z-index: 10;
}

/* =============================================================
   HOME VIEW
   ============================================================= */
.home-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  overflow: visible;
}
.home-view img,
.home-view svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  max-width: 900px;
  padding: 40px 60px;
  cursor: pointer;
}
@keyframes logo-float {
  0%   { transform: translateY(0px)  translateX(0px); }
  30%  { transform: translateY(-6px) translateX(3px); }
  60%  { transform: translateY(-3px) translateX(-4px); }
  100% { transform: translateY(0px)  translateX(0px); }
}
/* Per-letter float variants — % is relative to fill-box so scales correctly */
@keyframes logo-el-a {
  0%   { transform: translateY(0%)    translateX(0%); }
  35%  { transform: translateY(-8%)   translateX(4%); }
  70%  { transform: translateY(-3%)   translateX(-6%); }
  100% { transform: translateY(0%)    translateX(0%); }
}
@keyframes logo-el-b {
  0%   { transform: translateY(0%)    translateX(0%); }
  25%  { transform: translateY(-5%)   translateX(-5%); }
  60%  { transform: translateY(-10%)  translateX(3%); }
  100% { transform: translateY(0%)    translateX(0%); }
}
@keyframes logo-el-c {
  0%   { transform: translateY(0%)    translateX(0%); }
  40%  { transform: translateY(-7%)   translateX(6%); }
  75%  { transform: translateY(-2%)   translateX(-4%); }
  100% { transform: translateY(0%)    translateX(0%); }
}
@keyframes logo-el-d {
  0%   { transform: translateY(0%)    translateX(0%); }
  30%  { transform: translateY(-4%)   translateX(-6%); }
  65%  { transform: translateY(-9%)   translateX(5%); }
  100% { transform: translateY(0%)    translateX(0%); }
}
/* Per-bubble float variants — subtler than letters */
@keyframes logo-bub-a {
  0%   { transform: translateY(0%)   translateX(0%); }
  40%  { transform: translateY(-12%) translateX(8%); }
  70%  { transform: translateY(-5%)  translateX(-10%); }
  100% { transform: translateY(0%)   translateX(0%); }
}
@keyframes logo-bub-b {
  0%   { transform: translateY(0%)   translateX(0%); }
  30%  { transform: translateY(-8%)  translateX(-10%); }
  65%  { transform: translateY(-15%) translateX(6%); }
  100% { transform: translateY(0%)   translateX(0%); }
}
@keyframes logo-bub-c {
  0%   { transform: translateY(0%)   translateX(0%); }
  50%  { transform: translateY(-6%)  translateX(12%); }
  80%  { transform: translateY(-14%) translateX(-7%); }
  100% { transform: translateY(0%)   translateX(0%); }
}
@keyframes logo-bub-d {
  0%   { transform: translateY(0%)   translateX(0%); }
  35%  { transform: translateY(-14%) translateX(-8%); }
  60%  { transform: translateY(-5%)  translateX(10%); }
  100% { transform: translateY(0%)   translateX(0%); }
}
.home-view svg {
  overflow: visible;
}
/* Letter animation classes */
.home-view svg .logo-el-a,
.home-view svg .logo-el-b,
.home-view svg .logo-el-c,
.home-view svg .logo-el-d {
  transform-box: fill-box;
  transform-origin: center;
}
.home-view svg .logo-el-a { animation: logo-el-a  8.2s ease-in-out infinite; }
.home-view svg .logo-el-b { animation: logo-el-b  9.7s ease-in-out infinite; }
.home-view svg .logo-el-c { animation: logo-el-c  7.8s ease-in-out infinite; }
.home-view svg .logo-el-d { animation: logo-el-d 10.3s ease-in-out infinite; }
/* Bubble animation classes */
.home-view svg .logo-bub-a,
.home-view svg .logo-bub-b,
.home-view svg .logo-bub-c,
.home-view svg .logo-bub-d {
  transform-box: fill-box;
  transform-origin: center;
}
.home-view svg .logo-bub-a { animation: logo-bub-a 11.0s ease-in-out infinite; }
.home-view svg .logo-bub-b { animation: logo-bub-b 13.5s ease-in-out infinite; }
.home-view svg .logo-bub-c { animation: logo-bub-c 10.2s ease-in-out infinite; }
.home-view svg .logo-bub-d { animation: logo-bub-d 12.8s ease-in-out infinite; }
.home-view svg .letter-outlines { display: none; }
.home-view svg .subtext-letter-path {
  fill: var(--logo-letter-fill);
  transition: fill var(--transition);
}
.home-view svg path:not(.subtext-letter-path),
.home-view svg polygon:not(.subtext-letter-path) {
  fill: var(--logo-bubble-fill);
  transition: fill var(--transition);
}

/* Rogue circle — subtle drifting orb on home page, click to invert */
.home-view {
  position: relative;
}
.rogue-circle {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--black);
  opacity: 0.055;
  cursor: pointer;
  pointer-events: all;
  transition: opacity 0.4s ease, transform 0.2s ease;
  z-index: 10;
  left: 20%;
  top: 30%;
}
.rogue-circle:hover {
  opacity: 0.18;
  transform: scale(1.25);
}

/* About bubble — drifting yellow circle on home page, navigates to About */
.about-bubble {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(250, 242, 80, 0.72);
  border: 1px solid #000;
  cursor: grab;
  pointer-events: all;
  user-select: none;
  z-index: 10;
  left: 65%;
  top: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.about-bubble:active {
  cursor: grabbing;
  transform: scale(1.06);
}
.about-bubble:hover {
  transform: scale(1.08);
}
.about-bubble-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #000;
  pointer-events: none;
  user-select: none;
  text-transform: uppercase;
}

/* Settings bubble — similar to About bubble, different color */
.settings-bubble {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(171, 183, 250, 0.72);
  border: 1px solid #000;
  cursor: grab;
  pointer-events: all;
  user-select: none;
  z-index: 10;
  left: 15%;
  top: 65%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.settings-bubble:active {
  cursor: grabbing;
  transform: scale(1.06);
}
.settings-bubble:hover {
  transform: scale(1.08);
}
.settings-bubble-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #000;
  pointer-events: none;
  user-select: none;
  text-transform: uppercase;
}

/* About page */
.about-view {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  padding: 40px 40px;
  gap: 48px;
  box-sizing: border-box;
}
/* About text view - mobile only, full-screen justified text */
.about-text-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
}
.about-poster {
  flex: 0 0 auto;
  width: clamp(240px, 38vw, 520px);
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border: 1px solid #000;
  align-self: flex-start;
  position: sticky;
  top: 0;
}
.about-view .subtext-statement {
  flex: 1 1 auto;
  max-width: 600px;
  padding: 0;
}
.about-view .subtext-body {
  font-size: clamp(20px, 2.4vw, 36px);
  line-height: 1.25;
}
.about-highlight {
  background: #FAF250;
  color: inherit;
  padding: 0 2px;
}
@media (max-width: 768px) {
  .about-view {
    flex-direction: column;
    padding: 0;
    gap: 0;
    align-items: center;
    justify-content: center;
  }
  .about-poster {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    position: static;
  }
}

/* =============================================================
   SPECIAL VIEWS
   ============================================================= */
.subtext-show-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
}
.subtext-show-view canvas {
  max-width: 90%;
  max-height: 85%;
}

.gallery-3d-view {
  width: 100%;
  height: 100%;
}
.gallery-3d-view iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* =============================================================
   TREE PANEL — DESKTOP
   ============================================================= */
#tree-panel {
  width: var(--tree-width);
  border-left: var(--b);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--white);
  transition: width var(--transition);
  overflow: hidden;
  position: relative;
}

#tree-panel.collapsed {
  width: var(--tree-collapsed-width);
}

/* Collapse tab — sits at left edge of tree panel */
#tree-toggle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;           /* full height so the right border runs the full panel */
  width: 18px;
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  border-right: var(--b); /* permanent wall — always visible, full height */
}
#tree-toggle svg { transition: transform var(--transition); }
#tree-panel.collapsed #tree-toggle svg { transform: none; }
#tree-toggle svg { transform: scaleX(-1); }

/* Tree inner — sits to the right of the toggle tab */
#tree-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: 18px; /* offset for toggle tab */
  min-width: calc(var(--tree-width) - 18px);
  transition: opacity var(--transition);
  border-right: var(--b); /* right wall of the panel */
}
#tree-panel.collapsed #tree-inner {
  opacity: 0;
  pointer-events: none;
}

/* Tree search row — bordered box, matches content header height */
#tree-search-wrap {
  border-bottom: var(--b);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: var(--chrome-h);
  padding: 0 16px;
  gap: 10px;
}
#tree-search-wrap svg {
  flex-shrink: 0;
  opacity: 0.5;
}
#tree-search-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  background: transparent;
  color: var(--black);
}
#tree-search-wrap input::placeholder {
  color: var(--grey-dark);
  font-style: italic;
}

#tree-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Tree rows --------------------------------------------- */
.tree-item {
  display: flex;
  align-items: stretch;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  user-select: none;
  border-bottom: var(--b);
  min-height: 40px;
  background: var(--white);
  transition: background var(--transition);
}

.tree-item:hover { background: #f5f5f5; }
.tree-item.active { background: var(--white); }

/* Eye column */
.tree-item .eye-col {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: var(--b);
  cursor: pointer;
  transition: background var(--transition);
}
.tree-item .eye-icon {
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

/* Active: black eye col, left border closes the box */
.tree-item.active .eye-col {
  background: var(--black);
  border-left: var(--b);
}
.tree-item.active .eye-icon { opacity: 1; }

/* Eye filter on: yellow */
.tree-item.eye-on .eye-col { background: var(--yellow); }
.tree-item.eye-on .eye-icon { opacity: 1; }

/* Row body */
.tree-item .row-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px 0 8px;
  min-width: 0;
  overflow: hidden;
}

.tree-item .chevron {
  width: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform var(--transition);
}
.tree-item.open .chevron svg { transform: rotate(90deg); }

.tree-item .folder-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.tree-item .row-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 13px;
  color: var(--text-secondary);
}
/* Folder labels (MFA 2026, Students) — bold, full color */
.tree-item.is-folder .row-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--black);
}
.tree-item.active .row-label { font-weight: 600; color: var(--black); }

/* Subtext / Work children — subordinate by size only */
.tree-indent-3 .row-label {
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--black);
}

/* Indent levels */
.tree-indent-1 .row-body { padding-left: 16px; }
.tree-indent-2 .row-body { padding-left: 30px; }
.tree-indent-3 .row-body { padding-left: 44px; }

/* =============================================================
   TREE DRAWER — MOBILE
   ============================================================= */
#tree-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition);
  /* Clip right edge so backdrop never overlaps the drawer panel */
  right: min(85vw, 320px);
}
#tree-backdrop.open { opacity: 1; }

/* =============================================================
   LIGHTBOX
   ============================================================= */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#lightbox.open { display: flex; }

#lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.12s ease;
}

#lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  z-index: 10;
}

/* Lightbox nav arrows */
#lightbox-prev,
#lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 72px;
  background: none;
  border: none;
  cursor: pointer;
  display: none; /* shown via JS when sequence > 1 */
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity var(--transition);
  z-index: 10;
  padding: 0;
}
#lightbox-prev { left: 20px; }
#lightbox-next { right: 20px; }
#lightbox-prev:hover,
#lightbox-next:hover { opacity: 0.7; }

/* Counter pill */
#lightbox-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.1em;
  opacity: 0.6;
  display: none;
  pointer-events: none;
}

/* =============================================================
   FORM CONTROLS ACCENT COLOR
   ============================================================= */
/* Set accent color for checkboxes, radio buttons, sliders, progress bars */
input[type="checkbox"],
input[type="radio"],
input[type="range"],
progress {
  accent-color: #ABB7FA;
}

/* =============================================================
   SCROLLBAR
   ============================================================= */
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--black) var(--white); }
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--white); }
::-webkit-scrollbar-thumb { background: var(--black); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Dark mode transitions — smooth theme swap on key elements */
#desktop, #main-window, #window-chrome, #content-header,
#tree-panel, #tree-inner, #tree-search-wrap,
.tree-item, .masonry-item, .masonry-item .item-label,
.bio-card, .bio-portrait, .bio-btn-primary, .bio-btn-secondary,
.project-title, .empty-state, .subtext-statement, .subtext-title, .subtext-body, body {
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition);
}

/* Drawer header hidden on desktop */
#tree-drawer-header { display: none; }

/* =============================================================
   MOBILE — max-width: 768px
   ============================================================= */
@media (max-width: 768px) {

  #desktop { padding: 0; }

  #main-window {
    border: none;
    border-radius: 0;
  }

  #window-chrome { height: 32px; }
  #chrome-title  { font-size: 10px; }

  #content-header {
    padding: 0 14px;
    gap: 8px;
  }

  #breadcrumb {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #mobile-tree-btn { display: flex; }

  #content-scroll { padding: 6px 14px; }

  /* Hide desktop collapse tab on mobile */
  #tree-toggle { display: none; }

  /* Tree becomes fixed right drawer */
  #tree-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 85vw;
    max-width: 320px;
    height: 100%;
    border-left: var(--b);
    z-index: 300;
    transform: translateX(100%);
    transition: transform var(--transition);
    overflow: hidden;
  }
  #tree-panel.drawer-open { transform: translateX(0); }

  /* No tab offset, no right wall (drawer has its own borders) */
  #tree-inner {
    padding-left: 0;
    min-width: unset;
    opacity: 1 !important;
    pointer-events: auto !important;
    border-right: none;
  }

  .tree-item { min-height: 48px; font-size: 14px; }
  .tree-item .row-label { font-size: 14px; }
  .tree-item.is-folder .row-label { font-size: 13px; }

  #tree-backdrop.open { display: block; }

  /* Drawer header */
  #tree-drawer-header {
    height: 48px;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    flex-shrink: 0;
  }
  #tree-drawer-header span {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--white);
    text-transform: uppercase;
  }
  #tree-drawer-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1;
    padding: 4px;
  }
}

@media (max-width: 420px) {
  .masonry-grid { columns: 1; }
}
