/* Typed presence animates relief without flattening the nested 3D layers. */
@property --filter-presence {
  syntax: '<number>';
  inherits: true;
  initial-value: 1;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .36; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* The grid stays anchored to the page; only its soft reveal follows
   the cursor. Keep it below the scrolling content and controls. */
.ambient-light { position: absolute; z-index: 0; pointer-events: none; inset: 0; opacity: 0; background-image: radial-gradient(circle, var(--accent) 1px, transparent 1.5px); background-size: var(--dot-spacing) var(--dot-spacing); mask-image: radial-gradient(circle var(--dot-radius) at var(--pointer-x, 50%) var(--pointer-y, 50%), #000, rgb(0 0 0 / .65) 35%, transparent 100%); }
/* Navigation lives beside the page, with space reserved for its open label. */
#category-nav { position: absolute; z-index: 10; background: var(--surface); border-radius: 20px; top: 50%; left: max(20px, env(safe-area-inset-left)); transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-height: calc(100% - 32px); max-width: 174px; overflow-y: auto; scrollbar-width: none; padding: 6px; }
#category-nav::-webkit-scrollbar, #tag-filters::-webkit-scrollbar { display: none; }
.category-button { display: flex; align-items: center; flex: none; min-height: 44px; max-width: 100%; padding: 13px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: 13px; text-align: left; }
.category-button > .icon { width: 18px; height: 18px; }
.nav-label { display: flex; align-items: center; max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap; transition: max-width 260ms ease, margin 260ms ease, opacity 180ms ease; }
.category-button[aria-current] .nav-label, .category-button:focus-visible .nav-label { max-width: 125px; margin-left: 10px; opacity: 1; }
.category-button[aria-current] { background: var(--selected); color: var(--accent); box-shadow: inset 2px 2px 5px rgb(var(--shadow-dark) / .4), inset -2px -2px 5px rgb(var(--shadow-light) / .2); }
.nav-count { display: none; }
.nav-label > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.profile { display: flex; align-items: center; gap: 36px; width: 100%; max-width: 1260px; margin: 0 auto; padding: max(64px, env(safe-area-inset-top)) 28px 36px; min-height: 260px; }
.profile-logo { display: grid; place-items: center; flex: none; width: 144px; height: 144px; color: var(--accent); }
.profile-symbol { width: 100%; height: 100%; object-fit: contain; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.profile-details { min-width: 0; display: grid; grid-template-columns: minmax(0, max-content) auto; align-items: center; column-gap: 44px; }
h1 { grid-column: 1; grid-row: 1; margin: 0; font-size: clamp(56px, 5.3vw, 80px); font-weight: 450; line-height: 1.02; letter-spacing: -2.5px; white-space: pre-line; overflow-wrap: anywhere; }
#profile-bio { grid-column: 1/-1; grid-row: 2; max-width: 540px; margin: 20px 0 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.social-links { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 8px; }
.social-links:empty { display: none; }
.social-link { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 15px; text-decoration: none; color: var(--accent); background: var(--surface); box-shadow: 5px 5px 12px rgb(var(--shadow-dark) / .70), -5px -5px 12px rgb(var(--shadow-light) / .5), inset 1px 1px 1px rgb(var(--shadow-light) / .2); transition: color 180ms ease, transform 180ms ease; }
a.social-link:hover { color: var(--ink); transform: translateY(-2px); }
a.social-link:active { transform: none; box-shadow: inset 3px 3px 7px rgb(var(--shadow-dark) / .7), inset -3px -3px 7px rgb(var(--shadow-light) / .4); }
.social-link.is-placeholder .icon { opacity: .5; }
.bottom-dock { z-index: 1; background: var(--surface); flex: none; margin: 0 64px 0 212px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
#tag-filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 4px 3px; }
.filter-button { flex: none; display: inline-flex; gap: 7px; align-items: center; border: 1px solid transparent; border-radius: 8px; padding: 7px 10px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; }
.filter-button[aria-pressed="true"] { border-color: var(--line); background: var(--selected); color: var(--accent); }
.filter-button:hover, .category-button:not(:disabled):hover { color: var(--ink); background: var(--selected); }
#filter-mode { flex: none; font-size: 12px; color: var(--muted); }
.icon { display: inline-block; flex: none; height: 17px; width: 17px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; object-fit: contain; }
.glyph { font-family: Georgia, serif; font-size: 20px; line-height: 17px; text-align: center; }
.surface-shell { position: relative; z-index: 1; flex: 1; min-height: 0; overflow: hidden; }
.surface { position: relative; height: 100%; padding-left: 184px; padding-right: max(36px, env(safe-area-inset-right)); overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: none; outline-offset: -4px; mask-image: linear-gradient(to bottom, transparent, rgb(0 0 0 / .5) 18px, #000 48px, #000 calc(100% - 48px), rgb(0 0 0 / .5) calc(100% - 18px), transparent); }
.surface::-webkit-scrollbar { display: none; width: 0; height: 0; }
.grid { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px; width: 100%; max-width: 1260px; margin: 0 auto; padding: 28px 28px 120px; }
.relief { --e: 1; --content: 1; --filter-presence: 1; --depth: calc(var(--e)*var(--filter-presence)); }
.card { --layer-depth: 0; --rx: 0deg; --ry: 0deg; --shadow-offset: 11px; --shadow-blur: 24px; position: relative; min-height: 290px; min-width: 0; perspective: 850px; transform: scale(calc(.972 + var(--depth)*.028)); }
.card.tilting, .card:focus-within { z-index: 3; }
.card-face { position: relative; height: 100%; border-radius: calc(40px - var(--depth)*14px); transform-style: preserve-3d; transform: rotateX(calc(var(--rx)*var(--depth))) rotateY(calc(var(--ry)*var(--depth))); }
/* z=0 is the skin. Only leaf layers fade; opacity on a 3D parent
   would flatten the symbol and text into the same plane. */
.card-face::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgb(var(--shadow-light) / calc(var(--depth)*.10)), transparent 45%, rgb(var(--shadow-dark) / calc(var(--depth)*.08))), var(--surface);
  /* Matching soft pools of light and shadow, with a subtle directional
     rim instead of a uniform border around the whole card. */
  box-shadow:
    calc(var(--depth)*var(--shadow-offset)) calc(var(--depth)*var(--shadow-offset)) calc(2px + var(--depth)*var(--shadow-blur)) rgb(var(--shadow-dark) / calc(var(--depth)*.75)),
    calc(var(--depth)*var(--shadow-offset)*-1) calc(var(--depth)*var(--shadow-offset)*-1) calc(2px + var(--depth)*var(--shadow-blur)) rgb(var(--shadow-light) / calc(var(--depth)*.57)),
    inset 1px 1px 1px rgb(var(--shadow-light) / calc(var(--depth)*.30)),
    inset -1px -1px 1px rgb(var(--shadow-dark) / calc(var(--depth)*.26));
}
.card-background { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; opacity: calc(var(--content)*var(--image-opacity)*var(--filter-presence)); transform: translateZ(1px); mask-image: linear-gradient(110deg, transparent 5%, #000 90%); }
.card-logo-background { overflow: hidden; color: var(--accent); }
.background-symbol { position: absolute; top: -10%; right: -20%; width: 90%; height: 130%; object-fit: contain; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-12deg); }
.background-symbol.glyph { display: grid; place-items: center; font-size: 230px; line-height: 1; }
.card-content { position: relative; pointer-events: none; height: 100%; min-height: 290px; padding: 25px 25px 22px; display: flex; flex-direction: column; transform-style: preserve-3d; }
.card-content > * { opacity: calc(var(--content)*var(--filter-presence)); backface-visibility: hidden; }
.card-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; transform: translateZ(calc(var(--layer-depth)*8px)); }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; min-height: 38px; padding-top: 12px; margin-top: auto; transform: translateZ(calc(var(--layer-depth)*30px)); }
.tag-badge { position: relative; pointer-events: auto; display: grid; place-items: center; height: 28px; width: 28px; padding: 0; color: var(--accent); border: 0; border-radius: 7px; background: transparent; }
.tag-badge:hover, .tag-badge:focus-visible, .tag-badge[aria-expanded="true"] { background: var(--selected); }
.tag-badge::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: -4px; padding: 7px 9px; background: var(--tooltip); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: 12px/1.3 var(--font); white-space: nowrap; pointer-events: none; opacity: 0; }
.tag-badge:hover::after, .tag-badge:focus-visible::after, .tag-badge[aria-expanded="true"]::after { opacity: 1; }
.tag-badge.tooltip-dismissed::after { opacity: 0; }
.symbol { flex: none; width: 42px; height: 42px; margin: 21px 0 18px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; object-fit: contain; transform: translateZ(calc(var(--layer-depth)*58px)); filter: drop-shadow(0 7px 5px rgb(var(--shadow-dark) / calc(var(--depth)*.3))); }
.card h3 { margin: 0 0 9px; font-size: 22px; font-weight: 450; line-height: 1.2; letter-spacing: -.5px; transform: translateZ(calc(var(--layer-depth)*23px)); }
.project-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-link { position: absolute; inset: 0; border-radius: inherit; cursor: pointer; }
.card-link:focus-visible { outline-offset: 5px; }
.card:focus-within .project-title { color: var(--accent); }
.link-arrow { width: 16px; height: 16px; color: var(--accent); opacity: .6; }
.card-description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; transform: translateZ(calc(var(--layer-depth)*13px)); }
.card-category { color: var(--accent); font-size: 11px; letter-spacing: 1.25px; text-transform: uppercase; }
.section-heading { grid-column: 1/-1; display: flex; align-items: center; gap: 14px; min-height: 72px; margin: 18px 0 0; padding: 21px 25px; border-radius: 21px; font-size: 20px; font-weight: 450; letter-spacing: -.4px; background: linear-gradient(135deg, rgb(var(--shadow-dark) / calc(var(--depth)*.07)), rgb(var(--shadow-light) / calc(var(--depth)*.04))), var(--surface); box-shadow: inset calc(var(--depth)*6px) calc(var(--depth)*6px) calc(1px + var(--depth)*12px) rgb(var(--shadow-dark) / calc(var(--depth)*.64)), inset calc(var(--depth)*-6px) calc(var(--depth)*-6px) calc(1px + var(--depth)*12px) rgb(var(--shadow-light) / calc(var(--depth)*.48)); text-shadow: 0 1px 1px rgb(var(--shadow-dark) / calc(var(--depth)*.8)); }
.section-heading:first-child { margin-top: 0; }
.section-heading > * { opacity: calc(var(--content)*var(--filter-presence)); }
.section-heading .icon { color: var(--accent); }
.section-count { margin-left: auto; font-size: 11px; color: var(--muted); letter-spacing: 1px; white-space: nowrap; }
.empty { opacity: var(--filter-presence, 1); grid-column: 1/-1; padding: 25px; color: var(--muted); line-height: 1.6; text-align: center; }
.empty h2 { font-size: 21px; font-weight: 450; color: var(--ink); }
.empty .filter-button { border-color: var(--line); }
footer { flex: none; display: grid; grid-template-columns: 1fr auto; gap: 11px 24px; padding: 8px 0 max(18px, env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted); }
.hint-arrow { margin-left: 8px; font-size: 17px; color: var(--accent); }
#result-count { font-variant-numeric: tabular-nums; }
.track { grid-column: 1/-1; height: 7px; width: 100%; background: var(--surface); border-radius: 8px; overflow: hidden; box-shadow: inset 2px 2px 4px rgb(var(--shadow-dark) / .7), inset -2px -2px 4px rgb(var(--shadow-light) / .3); }
#progress { height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); border-radius: inherit; transform-origin: left; transform: scaleX(0); }
@media(hover:hover) and (pointer:fine) {
  .category-button:hover .nav-label { max-width: 125px; margin-left: 10px; opacity: 1; }
  .card:hover .project-title { color: var(--accent); }
}
/* Touch layouts use flat, aligned content. Perspective depth is reserved
   for layouts where a mouse can actually explore the layers. */
@media(min-width:601px) and (hover:hover) and (pointer:fine) {
  .card { --layer-depth: var(--depth); }
}
/* Once a full rail fits on either side, center the entire collection. */
@media(min-width:1640px) {
  .surface { padding-left: 0; padding-right: 0; }
  .bottom-dock { width: 1204px; max-width: calc(100% - 56px); margin-left: auto; margin-right: auto; }
}
@media(max-width:1100px) {
  .surface { padding-left: 162px; padding-right: 8px; }
  #category-nav { left: 10px; max-width: 154px; }
  .bottom-dock { margin-left: 186px; margin-right: 32px; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding-left: 24px; padding-right: 24px; gap: 28px; }
  .profile { padding-left: 24px; padding-right: 24px; }
  .profile-logo { width: 112px; height: 112px; }
  .profile { gap: 26px; }
  .profile-details { column-gap: 24px; }
  .card, .card-content { min-height: 250px; }
  .card-content { padding: 20px; }
  .symbol { margin: 16px 0; }
  #filter-mode { display: none; }
}
@media(max-width:900px) {
  .profile-details { display: flex; flex-direction: column; align-items: flex-start; }
  .social-links { margin: 18px 0 0; padding: 0; }
}
/* The phone rail expands vertically, keeping its label out of the cards. */
@media(max-width:760px) {
  .surface { padding-left: max(54px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
  #category-nav { left: max(5px, env(safe-area-inset-left)); max-width: 48px; gap: 9px; padding: 2px; }
  .category-button { flex-direction: column; width: 44px; padding: 13px; border-radius: 13px; }
  .nav-label { writing-mode: vertical-rl; max-width: 18px; max-height: 0; transition: max-height 260ms ease, margin 260ms ease, opacity 180ms ease; }
  .category-button[aria-current] .nav-label, .category-button:focus-visible .nav-label { max-width: 18px; max-height: 180px; margin: 10px 0 0; }
  .nav-count { display: none; }
  .bottom-dock { margin-left: max(14px, env(safe-area-inset-left)); margin-right: max(14px, env(safe-area-inset-right)); }
  .grid { padding-left: 18px; padding-right: 18px; }
  .profile { padding: max(40px, env(safe-area-inset-top)) 18px 20px; min-height: 224px; gap: 22px; }
  .profile-logo { width: 82px; height: 82px; }
  h1 { font-size: 46px; letter-spacing: -1.6px; }
  .social-links { margin-top: 18px; gap: 12px; }
  .social-link { width: 42px; height: 42px; border-radius: 13px; }
  #profile-bio { font-size: 14px; margin-top: 10px; }
  .surface { mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
}
@media(max-width:760px) and (hover:hover) and (pointer:fine) {
  .category-button:hover .nav-label { max-width: 18px; max-height: 180px; margin: 10px 0 0; }
}
/* Compact cards keep every field and a consistent inset for every logo. */
@media(max-width:600px), (max-width:1000px) and (max-height:500px) {
  .grid { padding-top: 24px; padding-bottom: 64px; row-gap: 24px; column-gap: 20px; }
  .card { --layer-depth: 0; min-height: 0; --shadow-offset: 7px; --shadow-blur: 16px; }
  .card-face { border-radius: calc(27px - var(--depth)*8px); }
  .card-content {
    min-height: 0; padding: 16px 18px; display: grid;
    grid-template-columns: 32px minmax(0,1fr);
    grid-template-areas: 'icon meta' 'icon title' 'description description' 'tags tags';
    align-content: start; column-gap: 12px; row-gap: 7px;
  }
  .card-content > * { min-width: 0; }
  .symbol { grid-area: icon; width: 32px; height: 32px; margin: 4px 0 0; align-self: start; justify-self: start; filter: none; }
  .card-top { grid-area: meta; font-size: 11px; gap: 4px 8px; }
  .card h3 { grid-area: title; margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.35px; }
  .project-title { min-height: 25px; overflow-wrap: anywhere; }
  .card-description { grid-area: description; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
  .card-tags { grid-area: tags; min-height: 0; padding-top: 0; margin-top: 0; gap: 5px; }
  .card-tags:empty { display: none; }
  .tag-badge { width: 32px; height: 32px; }
  .card-category { font-size: 10px; letter-spacing: .6px; }
  .section-heading { min-height: 48px; margin-top: 8px; padding: 12px 15px; border-radius: 16px; gap: 10px; font-size: 17px; }
  .section-count { font-size: 10px; }
  .surface { mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
}
@media(max-width:600px) {
  .grid { grid-template-columns: minmax(0,1fr); }
  #tag-filters { gap: 3px; padding: 3px 2px; }
  .filter-button { min-height: 38px; padding: 6px 8px; font-size: 12px; }
  footer { gap: 8px; padding: 5px 2px max(12px, env(safe-area-inset-bottom)); font-size: 11px; }
}
@media(max-height:500px) {
  .profile { min-height: 150px; padding-top: 28px; padding-bottom: 16px; }
  #category-nav { gap: 5px; }
  footer { padding-top: 3px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 5px; }
  #scroll-hint, #result-count { display: none; }
}
/* Small portrait screens get their width back; categories sit within
   the bottom dock, so they never obscure or squeeze the project cards. */
@media(max-width:600px), (max-width:760px) and (orientation:portrait) {
  .surface { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  #category-nav { position: static; transform: none; flex-direction: row; align-items: center; width: 100%; max-width: none; max-height: none; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 8px 2px max(12px, env(safe-area-inset-bottom)); }
  #category-nav .category-button { flex-direction: row; width: auto; max-width: none; }
  #category-nav .category-button:first-child { margin-left: auto; }
  #category-nav .category-button:last-child { margin-right: auto; }
  #category-nav .nav-label { writing-mode: horizontal-tb; max-width: 0; max-height: none; margin: 0; transition: max-width 260ms ease, margin 260ms ease, opacity 180ms ease; }
  #category-nav .category-button:is([aria-current], :focus-visible) .nav-label { max-width: 125px; max-height: none; margin: 0 0 0 9px; }
  footer { padding-bottom: 6px; }
}
@media(max-width:600px) and (hover:hover) and (pointer:fine), (max-width:760px) and (orientation:portrait) and (hover:hover) and (pointer:fine) {
  #category-nav .category-button:hover .nav-label { max-width: 125px; max-height: none; margin: 0 0 0 9px; }
}
@media(max-width:380px) {
  .profile { gap: 18px; }
  .profile-logo { width: 68px; height: 68px; }
  h1 { font-size: 40px; }
}
@media(hover:none), (pointer:coarse) { .ambient-light { display: none; } }
@media(prefers-reduced-motion:reduce) {
  .card, .card-face, .card-content > * { transform: none; }
  .card .symbol { filter: none; }
  .nav-label, #category-nav .nav-label, .social-link { transition: none; }
  .ambient-light { display: none; }
  a.social-link:hover { transform: none; }
}
