/* Skins: structure shared by index.html and cv.html (palettes live in tokens.css).

   Daylight, Mist and Midnight keep the original glass-and-glow design.
   Academic, Clinical and Graphite are the quiet, professional skins: solid surfaces with hairline
   borders, no particle field or glows, no blur, no hover-lift. They use CSS nesting; a browser too old
   for it simply shows the glass layout in the new colours, which is still readable. */

:root:is([data-look="academic"], [data-look="clinical"], [data-look="graphite"], [data-look="viewer"], [data-look="viewer-light"], [data-look="lightbox"], [data-look="journal"]) {
  --radius: 12px;
  --gap: clamp(0.75rem, 1.4vw, 1.1rem);
  --shadow: 0 1px 2px rgba(var(--sh), calc(0.10 * var(--sh-k))), 0 10px 26px -18px rgba(var(--sh), calc(0.30 * var(--sh-k)));
  --shadow-hover: var(--shadow);

  /* Background: no particles, glows, grain or vignette */
  .field { display: none; }

  /* Top bar: solid, hairline rule */
  .topbar,
  .topbar.scrolled {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--line);
  }
  .topbar::after { display: none; }
  .progress { background: var(--accent); }

  /* Cards */
  .tile,
  .rail-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .tile::before,
  .tile::after { display: none; }
  .tile:hover { transform: none; box-shadow: var(--shadow); }

  /* Headline */
  .hero h1 { text-shadow: none; font-weight: 650; letter-spacing: -0.03em; line-height: 1.02; }

  /* Pills, chips and buttons */
  .eyebrow,
  .addr {
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line) inset;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .eyebrow .dot { box-shadow: none; }
  .btn { border-radius: 10px; }
  .btn-primary,
  .btn-primary:hover { background: var(--btn); box-shadow: none; }
  .btn-primary:hover { background: var(--btn2); transform: none; }
  .btn-ghost {
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line) inset;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .btn-ghost:hover { box-shadow: 0 0 0 1px var(--accent) inset; transform: none; }

  /* Icons and brand mark */
  .ico,
  .ico.steel {
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent) inset;
  }
  .ico.steel {
    background: color-mix(in srgb, var(--accent2) 10%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent2) 26%, transparent) inset;
  }
  .brand .mark,
  .mark-badge { background: var(--accent); box-shadow: none; border-radius: 7px; }

  /* Portrait: plain framed photo */
  .portrait-wrap::before,
  .orbits,
  .portrait-card::after,
  .portrait::after,
  .portrait-card .sheen,
  .portrait .sheen,
  .vf { display: none; }
  .portrait-card,
  .portrait {
    padding: 6px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .portrait-card img,
  .portrait img { border-radius: 7px; }

  /* Statement highlight: solid colour instead of a gradient */
  .t-short .hl { background: none; -webkit-text-fill-color: currentColor; color: var(--accent); }

  /* Timeline markers: no glow */
  .timeline dt:first-of-type::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
}

/* Academic: serif headings (Source Serif 4, loaded on demand by skins.js), sans body */
:root[data-look="academic"] :is(h1, h2, h3, .tile-title, .section-head h2) {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.012em;
}
:root[data-look="academic"] .hero h1 { letter-spacing: -0.022em; font-weight: 600; }

/* ====================================================================================================
   Concept skins. They share the flat base above (no particle field, no blur, solid surfaces), then
   change structure, not just colour.
   ==================================================================================================== */

/* ---------- Viewer: a PACS reading-room viewport ---------- */
:root:is([data-look="viewer"], [data-look="viewer-light"]) {
  --radius: 0px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  .hero h1 { font-weight: 560; letter-spacing: -0.02em; }

  /* Tiles are square viewports with corner ticks; titles read like overlay text */
  .tile,
  .rail-card { border-radius: 0; box-shadow: none; background: var(--surface); }
  .tile::before {
    display: block;
    content: "";
    position: absolute;
    inset: 6px;
    padding: 0;
    border-radius: 0;
    -webkit-mask: none;
    mask: none;
    pointer-events: none;
    --c: color-mix(in srgb, var(--accent) 60%, transparent);
    --l: 10px;
    --w: 1px;
    background:
      linear-gradient(var(--c), var(--c)) left top / var(--l) var(--w) no-repeat,
      linear-gradient(var(--c), var(--c)) left top / var(--w) var(--l) no-repeat,
      linear-gradient(var(--c), var(--c)) right top / var(--l) var(--w) no-repeat,
      linear-gradient(var(--c), var(--c)) right top / var(--w) var(--l) no-repeat,
      linear-gradient(var(--c), var(--c)) left bottom / var(--l) var(--w) no-repeat,
      linear-gradient(var(--c), var(--c)) left bottom / var(--w) var(--l) no-repeat,
      linear-gradient(var(--c), var(--c)) right bottom / var(--l) var(--w) no-repeat,
      linear-gradient(var(--c), var(--c)) right bottom / var(--w) var(--l) no-repeat;
  }
  .tile:hover::before { background-color: transparent; }
  .tile-head,
  .t-patients .tile-head,
  .t-physicians .tile-head { min-height: 0; margin-bottom: 1rem; }
  .tile-title,
  .tile-label,
  .section-head h2,
  .impression .k {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--accent2);
  }
  .tile-head .ico,
  .section-head .ico,
  .impression .k .ico { display: none; }
  .eyebrow { font-family: var(--mono); font-size: 0.8rem; color: var(--accent2); }
  .eyebrow,
  .addr,
  .copy,
  .pill,
  .home,
  .topnav a,
  .section-head .count,
  .t-physicians .more a,
  .t-pubs .more a,
  .btn { border-radius: 2px; }
  .brand .mark,
  .mark-badge { border-radius: 0; }
  .t-short .hl { color: var(--accent); }

  /* The portrait is a plain black viewport */
  .portrait-card,
  .portrait {
    position: relative;
    padding: 0;
    border-radius: 0;
    background: #000;
    box-shadow: none;
  }
  .portrait-card img,
  .portrait img { border-radius: 0; }
}

/* Viewer Light: Interests and Projects are quiet reference tiles at the end of the page, set smaller */
:root[data-look="viewer-light"] {
  .t-interests,
  .t-projects { order: 1; padding: 1.05rem 1.25rem 1.1rem; }
  .t-interests { grid-column: span 4; }
  .t-projects { grid-column: span 8; }
  .t-interests .tile-head,
  .t-projects .tile-head { margin-bottom: 0.6rem; }
  .interests li {
    flex: none;
    padding: 0.4rem 0;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
  }
  .interests li:first-child { padding-top: 0; }
  .interests li::before { width: 5px; height: 5px; box-shadow: none; }
  .proj { padding: 0.55rem 0; gap: 0.1rem; }
  .proj:first-child { padding-top: 0; }
  .proj-head a { font-size: 0.95rem; }
  .proj-url { font-size: 0.8rem; }
  .proj p { font-size: 0.84rem; line-height: 1.4; }
}
@media (max-width: 1100px) {
  :root[data-look="viewer-light"] .t-interests,
  :root[data-look="viewer-light"] .t-projects { grid-column: 1 / -1; }
}

/* ---------- Lightbox: black film sheets on a bright, even light box ---------- */
:root[data-look="lightbox"] {
  --radius: 4px;

  body { background: radial-gradient(130% 60% at 50% 0%, #F8FBFD 0%, var(--bg) 55%, var(--bg-deep) 100%); }
  .topbar,
  .topbar.scrolled { background: color-mix(in srgb, var(--bg) 92%, transparent); }
  .hero h1 { font-weight: 640; }

  /* Film sheet: re-scope the palette so everything inside reads light-on-black */
  .tile,
  .rail-card {
    --fg: #F1F4F7; --fg2: #CFD6DD; --fg-soft: #CFD6DD; --muted: #9EA8B2; --muted-hi: #AEB7C0;
    --accent: #8FD3EC; --accent2: #AEBAC6; --gold-hi: #8FD3EC; --line: #2B3138; --surface: #161B20;
    --ov: 255, 255, 255; --sh: 0, 0, 0; --sh-k: 1; --hair: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    background: var(--film);
    border: 1px solid #1E2328;
    border-radius: var(--radius);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 22px 36px -22px rgba(20, 45, 70, 0.6), 0 5px 12px -7px rgba(20, 45, 70, 0.4);
  }
  /* The clip that holds the sheet to the light box */
  .tile::before,
  .portrait-card::before,
  .portrait::before {
    display: block;
    content: "";
    position: absolute;
    inset: -1px auto auto 50%;
    translate: -50% 0;
    width: 3.4rem;
    height: 0.42rem;
    padding: 0;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(#B6C0CA, #7E8995);
    -webkit-mask: none;
    mask: none;
    pointer-events: none;
    z-index: 2;
  }
  .tile:hover::before { background: linear-gradient(#B6C0CA, #7E8995); }
  .portrait-card,
  .portrait {
    position: relative;
    padding: 8px;
    background: var(--film);
    border: 1px solid #1E2328;
    border-radius: var(--radius);
    box-shadow: 0 22px 36px -22px rgba(20, 45, 70, 0.6), 0 5px 12px -7px rgba(20, 45, 70, 0.4);
  }
  .portrait-card img,
  .portrait img { border-radius: 2px; }
  .btn-primary,
  .btn-primary:hover { background: var(--btn); color: var(--btn-fg); }
  .btn-primary:hover { background: var(--btn2); }
  .tile .btn-ghost,
  .tile .copy { color: var(--fg); }
  .t-short .hl { color: var(--accent); }
}

/* ---------- Journal: a medical-journal article. Labels in a left margin, no cards. ---------- */
:root[data-look="journal"] {
  --radius: 0px;

  & :is(h1, h2, h3, .tile-title, .section-head h2) { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
  body { line-height: 1.62; }
  .hero h1 { font-weight: 600; letter-spacing: -0.022em; line-height: 1.04; }
  .brand .mark,
  .mark-badge { border-radius: 2px; }
  .eyebrow {
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--accent);
    font-weight: 600;
  }
  .eyebrow .dot { display: none; }
  .eyebrow,
  .addr,
  .copy,
  .pill,
  .home,
  .topnav a,
  .btn,
  .section-head .count,
  .t-physicians .more a,
  .t-pubs .more a { border-radius: 2px; }
  .portrait-card,
  .portrait { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
  .portrait-card img,
  .portrait img { border-radius: 0; }
  .portrait-wrap { width: min(100%, 300px); }

  /* No cards: hairline-ruled sections */
  .tile,
  .rail-card { background: none; border: 0; border-top: 1px solid var(--line); box-shadow: none; padding-inline: 0; }
  .rail-card { padding-inline: 0.25rem; }
  .tile-head .ico,
  .section-head .ico,
  .impression .k .ico { display: none; }
  .tile-title,
  .tile-label,
  .section-head h2,
  .impression .k {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-transform: none;
    line-height: 1.25;
    color: var(--accent);
  }

  /* Home page: the section title moves into the left margin, beside its text */
  .bento { display: block; }
  .bento .tile {
    display: grid;
    grid-template-columns: 11.5rem minmax(0, 1fr);
    column-gap: 2.5rem;
    align-items: start;
    padding-block: 1.75rem 2rem;
  }
  .bento .tile > .tile-head {
    grid-column: 1;
    grid-row: 1 / span 8;
    margin: 0;
    min-height: 0;
    position: sticky;
    top: 5rem;
  }
  .bento .tile > :not(.tile-head):not(.vf) { grid-column: 2; min-width: 0; }
  .bento .t-short { padding-inline: 0; min-height: 0; }
  .bento .t-short p { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.8rem); line-height: 1.35; font-weight: 400; letter-spacing: -0.012em; }
  .bento .t-short p .hl { font-weight: 600; }
  .publist { grid-template-columns: minmax(0, 1fr); }
  .pub:nth-child(2) { border-top: 1px solid var(--line); padding-top: 1.15rem; }
  .tile .body p.more { border-top-color: var(--line); }
  .timeline dd,
  .roles dd,
  .pub p,
  .tile .body p { font-size: 1.02rem; }
  .vf { display: none; }

  @media (max-width: 899px) {
    .bento .tile { grid-template-columns: minmax(0, 1fr); }
    .bento .tile > .tile-head { grid-column: 1; grid-row: auto; position: static; margin-bottom: 0.9rem; }
    .bento .tile > :not(.tile-head):not(.vf) { grid-column: 1; }
  }
}

/* ---------- Appearance picker ---------- */
.look-picker {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
}
.lp-toggle {
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.95rem 0 0.8rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--fg);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 0 0 1px var(--line) inset, 0 8px 24px -12px rgba(var(--sh), calc(0.7 * var(--sh-k)));
  transition: box-shadow 160ms;
}
.lp-toggle:hover { box-shadow: 0 0 0 1px var(--accent) inset, 0 8px 24px -12px rgba(var(--sh), calc(0.7 * var(--sh-k))); }
.lp-toggle svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.lp-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  min-width: 12.5rem;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line) inset, 0 18px 44px -16px rgba(var(--sh), calc(0.8 * var(--sh-k)));
}
.lp-menu[hidden] { display: none; }
.lp-menu { max-height: calc(100vh - 6rem); overflow-y: auto; }
.lp-group { padding: 0.55rem 0.65rem 0.2rem; font-size: 0.68rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.lp-title {
  padding: 0.45rem 0.65rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.lp-menu button {
  font: inherit;
  font-weight: 560;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 44px;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.lp-menu button:hover { background: rgba(var(--ov), 0.07); }
.lp-menu button[aria-pressed="true"] { background: rgba(var(--ov), 0.09); box-shadow: 0 0 0 1px var(--line) inset; }
.lp-menu button[aria-pressed="true"]::after { content: "\2713"; margin-left: auto; color: var(--accent); font-weight: 700; }
.lp-menu i {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  border-radius: 50%;
  background: var(--sw-bg);
  box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.45) inset;
  display: grid;
  place-items: center;
}
.lp-menu i::after { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--sw-ac); }
@media (max-width: 599px) {
  .lp-name { display: none; }
  .lp-toggle { padding: 0 0.8rem; }
}
/* Room for the picker below the footer so it never covers the last line */
body::after { content: ""; display: block; height: 4rem; }
@media print {
  .look-picker { display: none !important; }
  body::after { display: none; }
}
