/* ==========================================================================
   Joseph A Levy — site styles
   Single-page site. No build step. Sections below map to the page order:
   tokens, base, header, intro, projects, bookshelf, dialog, footer, responsive, motion.
   ========================================================================== */

/* --- Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/geist-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens --------------------------------------------------------------- */

:root {
  --paper: #f6f4ef;
  --ink: #1a1917;
  --ink-muted: #5c5953;
  --rule: #ddd8cf;
  --signal: #3047c7;
  --surface: #fcfbf8;
  --glass-solid: #fbfaf7;
  --glass-fill: linear-gradient(135deg, rgba(255, 255, 255, 0.79), rgba(255, 255, 255, 0.47) 57%, rgba(226, 235, 255, 0.39));
  --glass-border: rgba(255, 255, 255, 0.82);
  --glass-shadow: 0 24px 58px rgba(43, 56, 96, 0.14);

  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --body: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --shell: 1180px;
  --gutter: 64px;
}

/* --- Base ----------------------------------------------------------------- */

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 620px 520px at 96% 10%, rgba(119, 146, 230, 0.39), transparent 73%),
    radial-gradient(ellipse 700px 560px at 1% 45%, rgba(235, 180, 150, 0.31), transparent 75%),
    radial-gradient(ellipse 650px 530px at 91% 82%, rgba(115, 176, 210, 0.34), transparent 74%);
  color: var(--ink);
  font: 17px/1.6 var(--body);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.75rem, 6.3vw, 5.25rem); }
h2 { font-size: clamp(2.05rem, 3.5vw, 3.1rem); }
h3 { font-size: 1.75rem; }

/* An italic phrase in a heading is the one accent in the display face. */
h1 em {
  color: var(--signal);
  font-style: italic;
}

a {
  color: inherit;
  text-decoration-color: var(--signal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--signal); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
  border-radius: 2px;
}

.shell {
  width: min(var(--shell), calc(100% - var(--gutter)));
  margin-inline: auto;
}

.glass-panel {
  border: 1px solid var(--glass-border);
  background: var(--glass-solid);
  box-shadow: var(--glass-shadow), 0 0 0 1px rgba(64, 76, 114, 0.12), inset 0 1px rgba(255, 255, 255, 0.94);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-panel {
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(28px) saturate(145%);
    backdrop-filter: blur(28px) saturate(145%);
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font: 13px var(--mono);
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* --- Header --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 10px 24px;
  border-radius: 999px;
  font: 13px var(--mono);
}

.wordmark {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font: 400 24px var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-decoration: none;
}

/* --- Intro ---------------------------------------------------------------- */

main { flex: 1; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 30vw, 360px);
  grid-template-areas: "copy portrait";
  align-items: end;
  gap: clamp(24px, 4vw, 56px);
  padding: 76px 0 72px;
}

.intro-copy { grid-area: copy; }

/* Joseph's stippled headshot blends into the paper and fades at the bottom. */
.portrait {
  grid-area: portrait;
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: -72px;
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}

.kicker {
  margin: 0 0 26px;
  color: var(--ink-muted);
  font: 15px var(--mono);
}

.intro h1 {
  max-width: 20ch;
  text-wrap: balance;
}

.lead {
  max-width: 46ch;
  margin: 34px 0 0;
  font-size: clamp(1.2rem, 1.9vw, 1.5rem);
  line-height: 1.45;
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 26px 0 0;
  font: 13px var(--mono);
}

.inline-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid rgba(48, 71, 199, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.53);
  color: var(--signal);
  text-decoration: none;
}

.inline-links a:hover {
  border-color: var(--signal);
  background: rgba(255, 255, 255, 0.82);
}

/* --- Projects ------------------------------------------------------------- */

.section {
  padding: 76px 0 104px;
  border-top: 1px solid var(--rule);
}

.section-heading { margin-bottom: 32px; }

.section-subtitle {
  max-width: 56ch;
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-size: 1.12rem;
  line-height: 1.45;
}

.work-section { padding: 58px 0 64px; }

.work-section .section-heading { margin-bottom: 24px; }

.work-list {
  display: grid;
  gap: 0;
  border-radius: 20px;
  box-shadow: 0 24px 58px rgba(43, 56, 96, 0.16), 0 0 0 1px rgba(64, 76, 114, 0.14);
}

.work-card {
  position: relative;
  min-height: 132px;
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.98), inset 0 -1px rgba(255, 255, 255, 0.5);
  transition: box-shadow 160ms ease;
}

.work-card + .work-card { border-top: 0; }

.work-card:first-child { border-radius: 20px 20px 0 0; }

.work-card:last-child { border-radius: 0 0 20px 20px; }

.work-card::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.98), inset 0 -1px rgba(255, 255, 255, 0.62);
  content: "";
  pointer-events: none;
}

/* Hover and keyboard focus share one lift; keyboard focus adds the outline.
   :focus-visible keeps a mouse click (or a closed dialog returning focus)
   from leaving a card outlined. */
.work-card:hover,
.work-card:has(.card-open:focus-visible) {
  z-index: 1;
  box-shadow: 0 16px 38px rgba(33, 42, 69, 0.15);
}

.work-card:has(.card-open:focus-visible) {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
}

.slide-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--orb-x) 46%, var(--slide-glow), transparent 42%),
    linear-gradient(120deg, var(--slide-a), var(--slide-b));
}

.slide-art::before {
  position: absolute;
  top: var(--orb-top);
  left: var(--orb-x);
  width: min(220px, 30%);
  aspect-ratio: 1;
  border: 1px solid rgba(41, 58, 110, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(255, 255, 255, 0.13), 0 0 0 72px rgba(255, 255, 255, 0.1);
  content: "";
  transform: translateX(-50%);
}

.work-card[data-project="count-my-points"] {
  --slide-a: #dce8fb;
  --slide-b: #f5dcd5;
  --slide-glow: rgba(73, 110, 222, 0.5);
  --orb-x: 82%;
  --orb-top: -42px;
}

.work-card[data-project="taam-im"] {
  --slide-a: #e3e0fa;
  --slide-b: #d7e9ec;
  --slide-glow: rgba(131, 98, 199, 0.46);
  --orb-x: 68%;
  --orb-top: -70px;
}

.work-card[data-project="crowd-scouter"] {
  --slide-a: #d9ede8;
  --slide-b: #efe7cf;
  --slide-glow: rgba(81, 163, 160, 0.43);
  --orb-x: 58%;
  --orb-top: 34px;
}

.work-card[data-project="inbox-watch"] {
  --slide-a: #f1e6da;
  --slide-b: #e6e2ec;
  --slide-glow: rgba(196, 140, 98, 0.4);
  --orb-x: 86%;
  --orb-top: 48px;
}

.work-card[data-project="nextmeeting"] {
  --slide-a: #dce9f3;
  --slide-b: #e2e9d9;
  --slide-glow: rgba(85, 142, 188, 0.45);
  --orb-x: 92%;
  --orb-top: 10px;
}

/* At rest the frost is light enough that each card keeps its own tint. */
.slide-frost {
  position: absolute;
  inset: 0;
  background: rgba(251, 250, 247, 0.62);
  pointer-events: none;
  transition: background 260ms ease, backdrop-filter 260ms ease, -webkit-backdrop-filter 260ms ease;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .slide-frost {
    -webkit-backdrop-filter: blur(32px) saturate(85%);
    backdrop-filter: blur(32px) saturate(85%);
  }
}

.work-card:has(.card-open:focus-visible) .slide-frost {
  background: rgba(251, 250, 247, 0.08);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
}

@media (hover: hover) {
  .work-card:hover .slide-frost {
    background: rgba(251, 250, 247, 0.08);
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

/* Touch screens never hover, so show a little more colour at rest. */
@media (hover: none) {
  .slide-frost { background: rgba(251, 250, 247, 0.5); }
}

/* Every card uses the same fixed last column so taglines and cues line up. */
.slide-content {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 132px;
  grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) 170px;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  background: linear-gradient(90deg, rgba(250, 249, 246, 0.55), rgba(250, 249, 246, 0.2) 62%, rgba(250, 249, 246, 0));
}

.card-heading {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}

.work-card h3 {
  margin: 0;
  font-size: clamp(1.85rem, 2.8vw, 2.5rem);
}

.card-open {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.card-open:focus-visible {
  outline: none;
}

.card-tagline {
  max-width: 42ch;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.36;
}

.card-bottom {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
  white-space: nowrap;
}

.card-cue {
  color: var(--signal);
  font: 12px var(--mono);
  transition: opacity 160ms ease;
}

.card-cue span { font-size: 15px; }

/* With a pointer, the cue appears only on the card being hovered or focused. */
@media (hover: hover) {
  .card-bottom {
    position: relative;
    align-self: stretch;
    justify-content: center;
  }

  .card-cue {
    position: absolute;
    right: 0;
    bottom: 0;
    opacity: 0;
  }

  .work-card:hover .card-cue,
  .work-card:has(.card-open:focus-visible) .card-cue { opacity: 1; }
}

.card-domain {
  color: var(--ink-muted);
  font: 12px var(--mono);
  white-space: nowrap;
}

/* On cards the status is a quiet label, not a pill; the dialog keeps the pill. */
.work-card .status {
  padding: 0;
  border: 0;
  background: none;
}

/* --- Status, meta --------------------------------------------------------- */

.status,
.footer-credit {
  color: var(--ink-muted);
  font: 12px var(--mono);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  align-self: flex-start;
  border: 1px solid rgba(74, 86, 122, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
}

.prototype .dot,
.under-development .dot {
  opacity: 0.55;
}
.internal .dot { background: var(--ink-muted); }

.concept .dot {
  border: 1.5px solid var(--ink-muted);
  background: transparent;
}

/* --- Bookshelf ------------------------------------------------------------ */

.bookcase-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.bookcase-panel {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  grid-template-areas:
    "stage copy"
    "stage rack"
    "ledge ledge";
  column-gap: 28px;
  padding: 30px 32px 28px;
  border-radius: 28px;
}

/* Featured book: stands face-out on the ledge, turned to show its spine. */
.bookcase-stage {
  position: relative;
  display: flex;
  grid-area: stage;
  align-items: flex-end;
  align-self: end;
  justify-content: center;
  perspective: 900px;
}

.bookcase-stage::after {
  position: absolute;
  z-index: -1;
  right: 8%;
  bottom: -6px;
  left: 14%;
  height: 16px;
  background: radial-gradient(closest-side, rgba(30, 37, 53, 0.3), transparent);
  content: "";
}

.bookcase-book {
  --t: 22px;
  --case-color: #394c74;
  position: relative;
  width: 144px;
  height: 216px;
  transform: rotateY(34deg);
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bookcase-stage:hover .bookcase-book {
  transform: rotateY(8deg);
}

.bookcase-book.is-turning {
  animation: bookcase-turn 560ms cubic-bezier(0.2, 0.9, 0.25, 1.12);
}

.bookcase-book > * {
  position: absolute;
  inset: 0;
  border-radius: 2px 4px 4px 2px;
  transform: translateZ(calc(var(--t) / 2));
}

/* Spine face, in the same color as the book's spine on the shelf. */
.bookcase-book::before {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--t);
  height: 100%;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(255, 255, 255, 0.14) 45%, rgba(0, 0, 0, 0.22)),
    var(--case-color);
  content: "";
  transform: translateX(-50%) rotateY(-90deg);
}

/* Back board, which casts the book's shadow. */
.bookcase-book::after {
  position: absolute;
  inset: 0;
  border-radius: 2px 4px 4px 2px;
  background: #d8d1c3;
  box-shadow: 10px 14px 26px rgba(29, 36, 54, 0.26);
  content: "";
  transform: translateZ(calc(var(--t) / -2));
}

.bookcase-book img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.bookcase-book img[hidden],
.bookcase-jacket[hidden] {
  display: none;
}

.bookcase-jacket {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px 14px 22px;
  background: linear-gradient(145deg, #fffcf6, #e8e3d9);
  box-shadow: inset 8px 0 var(--case-color), inset 0 0 0 1px rgba(61, 64, 71, 0.14);
  color: var(--ink);
  font: 400 19px/1.08 var(--display);
  overflow: hidden;
}

.bookcase-jacket.is-blank {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.1)), var(--case-color);
  box-shadow: none;
}

.bookcase-jacket.is-blank > * {
  visibility: hidden;
}

.bookcase-jacket span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow-wrap: anywhere;
}

.bookcase-jacket small {
  color: var(--ink-muted);
  font: 11px/1.3 var(--body);
}

/* Selected-book copy: full titles wrap freely. The minimum height fits the
   longest title in the list (measured at 768–1280px and 375px), so the shelf
   stays put as the selection changes; it can only grow on very narrow screens. */
.bookcase-copy {
  display: flex;
  min-width: 0;
  min-height: var(--copy-height, 150px);
  grid-area: copy;
  flex-direction: column;
}

.bookcase-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0 0 6px;
  color: var(--signal);
  font: 12px var(--mono);
}

.bookcase-status.is-current::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9a93a;
  box-shadow: 0 0 0 3px rgba(217, 169, 58, 0.22);
  content: "";
}

.bookcase-copy h3 {
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.08;
  text-wrap: balance;
}

.bookcase-subtitle,
.bookcase-author {
  margin: 0;
  text-wrap: pretty;
}

.bookcase-subtitle {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 1.02rem;
  font-style: italic;
}

.bookcase-subtitle:empty {
  display: none;
}

.bookcase-author {
  margin-top: 6px;
  font: 500 13px var(--body);
}

/* Controls share the copy's first row, level with the status line. */
.bookcase-controls {
  display: flex;
  grid-area: copy;
  align-items: center;
  align-self: start;
  justify-self: end;
  gap: 8px;
}

.bookcase-arrow {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(48, 71, 199, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--signal);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.bookcase-arrow {
  font: 18px var(--body);
}

.bookcase-arrow:hover:not([aria-disabled="true"]) {
  border-color: var(--signal);
  background: var(--surface);
}

.bookcase-arrow[aria-disabled="true"] {
  cursor: default;
  opacity: 0.35;
}

/* Rail: hidden scrollbar, soft fades on whichever edge has more books. */
.bookcase-rack {
  --fade-start: 0px;
  --fade-end: 0px;
  position: relative;
  min-width: 0;
  grid-area: rack;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent);
  scrollbar-width: none;
}

.bookcase-rack::-webkit-scrollbar {
  display: none;
}

.bookcase-rack.fade-start { --fade-start: 44px; }
.bookcase-rack.fade-end { --fade-end: 44px; }

.bookcase-spines {
  display: flex;
  width: max-content;
  align-items: flex-end;
  gap: 3px;
  padding: 28px 4px 0 2px;
}

.case-spine {
  --band: rgba(255, 255, 255, 0.34);
  position: relative;
  display: flex;
  width: var(--w, 38px);
  height: var(--spine-h, 176px);
  flex: none;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 22px;
  border: 0;
  border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(to bottom, transparent 9px, var(--band) 9px 11px, transparent 11px 14px, var(--band) 14px 15px, transparent 15px),
    linear-gradient(to top, transparent 8px, var(--band) 8px 10px, transparent 10px 13px, var(--band) 13px 14px, transparent 14px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 32%, rgba(0, 0, 0, 0.2)),
    var(--spine-color);
  box-shadow: inset 0 0 0 1px rgba(20, 26, 40, 0.14), 2px 0 5px rgba(30, 37, 53, 0.12);
  color: var(--spine-ink);
  cursor: pointer;
  transition: transform 280ms cubic-bezier(0.3, 1.45, 0.5, 1), box-shadow 200ms ease;
}

/* Gold foil bands mark the books in progress. */
.case-spine.is-current {
  --band: #f1d27f;
}

.case-spine.is-current + .case-spine:not(.is-current) {
  margin-left: 14px;
}

.case-spine-title,
.case-spine-author {
  min-height: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  writing-mode: vertical-rl;
}

.case-spine-title {
  flex: 1;
  font: 500 12px/1.12 var(--body);
  text-overflow: clip;
  white-space: normal;
}

.case-spine-author {
  flex: none;
  margin-top: 10px;
  font: 9.5px/1 var(--mono);
  letter-spacing: 0.08em;
  opacity: 0.78;
  text-transform: uppercase;
}

@media (hover: hover) {
  .case-spine:hover {
    transform: translateY(-8px);
  }
}

.case-spine[aria-pressed="true"] {
  transform: translateY(-16px);
  box-shadow: inset 0 0 0 1px rgba(20, 26, 40, 0.14), 0 10px 18px rgba(30, 37, 53, 0.22);
}

/* A small marker in the gap left by the lifted book. */
.case-spine[aria-pressed="true"]::after {
  position: absolute;
  bottom: -11px;
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  content: "";
}

.case-spine:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 3px;
}

.bookcase-ledge {
  height: 12px;
  grid-area: ledge;
  margin-inline: -10px;
  border-radius: 3px;
  background: linear-gradient(#fefcf8, #e4ddd1);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.95), 0 0 0 1px rgba(64, 76, 114, 0.12), 0 12px 16px -10px rgba(30, 37, 53, 0.4);
}

@keyframes bookcase-turn {
  from { transform: rotateY(84deg) translateX(-12px); }
  to { transform: rotateY(34deg); }
}

/* --- Project dialog ------------------------------------------------------- */

.project-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  overflow-y: auto;
  box-shadow: 0 26px 76px rgba(22, 25, 27, 0.24);
}

.project-dialog::backdrop { background: rgba(22, 25, 27, 0.44); }

.dialog-frame { position: relative; }

.dialog-close {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass-solid);
  color: var(--ink);
  font: 400 26px/1 var(--body);
  cursor: pointer;
}

.dialog-close:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.project-tile {
  padding: 54px;
  border-radius: 24px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.78);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .project-tile {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(240, 246, 255, 0.74));
  }
}

.project-dialog[open] .project-tile {
  animation: tile-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-tile h2 {
  margin: 18px 0 10px;
  font-size: clamp(2.4rem, 5.6vw, 3.9rem);
}

.tagline {
  max-width: 50ch;
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.34;
}

.tile-meta {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.tile-meta p { margin: 0 0 10px; }

.tile-actions { margin: 20px 0 0; }

/* Screenshot strip: scrolls sideways inside the dialog when the shots
   outgrow it, snapping to each image. */
.tile-shots {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 20px 0 0;
  padding: 0 0 8px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.tile-shots[hidden] { display: none; }

.tile-shots li {
  flex: 0 0 min(220px, 72%);
  scroll-snap-align: start;
}

.project-dialog[data-project="taam-im"] .tile-shots li {
  flex-basis: 100%;
}

.tile-shots img {
  display: block;
  width: 100%;
  height: auto;
}

.tile-shots:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
}

/* Availability note shown instead of a Visit link ("Under development"). */
.tile-note {
  color: var(--ink-muted);
  font: 13px var(--mono);
}

.action {
  display: inline-block;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font: 13px var(--mono);
  text-decoration: none;
}

.action:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

@keyframes tile-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  padding: 27px 0 38px;
  border-top: 1px solid var(--rule);
  font: 12px var(--mono);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.social-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
}

.social-icon:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.social-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.footer-credit {
  color: var(--ink-muted);
  letter-spacing: 0;
  text-transform: none;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 767px) {
  :root { --gutter: 40px; }

  .site-header {
    margin-top: 16px;
    padding: 6px 18px;
  }

  .nav { gap: 16px; }

  .intro {
    grid-template-columns: 1fr;
    grid-template-areas:
      "portrait"
      "copy";
    gap: 8px;
    padding: 32px 0 52px;
  }

  .portrait {
    width: 180px;
    margin-bottom: 0;
  }

  .lead { margin-top: 26px; }

  .section { padding: 52px 0 60px; }

  .work-list { border-radius: 18px; }

  .work-card {
    min-height: 185px;
    border-radius: 0;
  }

  .work-card:first-child { border-radius: 18px 18px 0 0; }
  .work-card:last-child { border-radius: 0 0 18px 18px; }

  .slide-art::before {
    width: 160px;
  }

  .slide-content {
    display: flex;
    min-height: 185px;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    padding: 18px 20px;
    background: linear-gradient(90deg, rgba(250, 249, 246, 0.6), rgba(250, 249, 246, 0.3) 72%, rgba(250, 249, 246, 0.1));
  }

  .card-heading { gap: 6px; }

  .card-tagline {
    margin-top: 10px;
    font-size: 1.03rem;
  }

  .card-bottom {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 12px;
    margin-top: auto;
    padding-top: 12px;
  }

  .bookcase-panel {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
      "stage copy"
      "rack rack"
      "ledge ledge";
    column-gap: 18px;
    padding: 20px 18px 20px;
    border-radius: 20px;
  }

  .bookcase-stage {
    align-self: start;
    padding-top: 4px;
  }

  .bookcase-book {
    --t: 14px;
    width: 80px;
    height: 120px;
  }

  .bookcase-jacket {
    padding: 10px 8px 8px 14px;
    font-size: 13px;
    box-shadow: inset 5px 0 var(--case-color), inset 0 0 0 1px rgba(61, 64, 71, 0.14);
  }

  .bookcase-jacket small {
    font-size: 8.5px;
  }

  .bookcase-copy {
    --copy-height: 188px;
  }

  .bookcase-copy h3 {
    font-size: 1.3rem;
  }

  .bookcase-subtitle {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .bookcase-author {
    font-size: 12px;
  }

  /* The two arrows fit exactly under the cover, sharing its column. */
  .bookcase-controls {
    grid-area: stage;
    align-self: end;
    justify-self: center;
  }

  .bookcase-status {
    min-height: 0;
  }

  .bookcase-spines {
    padding-top: 26px;
  }

  .bookcase-ledge {
    margin-inline: -6px;
  }

  .project-tile { padding: 64px 24px 30px; }
  .project-tile h2 { margin-top: 14px; }

  .footer-top,
  .footer-links {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .social-icon {
    width: 40px;
    height: 40px;
  }

  .footer-credit {
    font-size: 10.5px;
    white-space: nowrap;
  }
}

/* Smallest phones: keep the wordmark and three header links on one row. */
@media (max-width: 374px) {
  .site-header {
    gap: 12px;
    padding: 6px 14px;
  }

  .wordmark { font-size: 21px; }

  .nav { gap: 12px; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-panel,
  .project-tile {
    background: var(--glass-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .slide-frost {
    background: rgba(251, 250, 247, 0.94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .work-card:has(.card-open:focus-visible) .slide-frost { background: rgba(251, 250, 247, 0.78); }

  @media (hover: hover) {
    .work-card:hover .slide-frost { background: rgba(251, 250, 247, 0.78); }
  }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
