/* ==========================================================================
   Projects: pinned showcase, the HUD stage and the media "prints" pinned
   around the particle sculpture (screenshots, figures and UI sketches)
   ========================================================================== */

.projects { height: 640vh; }
.projects-pin {
    position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; padding: 104px 0 64px;
}
.ghost-index {
    position: absolute; left: -2vw; bottom: -6vw; z-index: -1; pointer-events: none;
    font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); font-size: clamp(260px, 42vw, 680px); line-height: 0.75; letter-spacing: -0.06em;
    color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--ink) 9%, transparent);
}
.ghost-num { display: inline-block; }

.projects-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(16px, 3vh, 40px); }
.projects-title {
    display: flex; align-items: flex-start; gap: 10px;
    font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch);
    font-size: clamp(22px, 2.1vw, 32px); line-height: 1; letter-spacing: -0.03em;
}
.projects-title sup { font-size: 11px; color: var(--accent); letter-spacing: 0.04em; margin-top: 0.1em; font-weight: 500; }
.project-pagination { display: flex; gap: 6px; }
.project-pagination button { position: relative; width: 58px; padding: 10px 0 12px; text-align: left; font-family: var(--mono); font-size: 12px; color: var(--muted); transition: color 0.4s; }
.project-pagination button i { position: absolute; left: 0; right: 6px; bottom: 0; height: 1px; background: var(--line); overflow: hidden; }
.project-pagination button i::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: left; }
.project-pagination button[aria-current="true"], .project-pagination button:hover { color: var(--ink); }

.showcase { position: relative; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr); align-items: center; gap: 5vw; flex: 1; min-height: 0; }
.showcase-copy { position: relative; display: grid; }
/* Inactive projects stay in the accessibility tree (only faded out), so screen
   readers can reach every project; focusing one scrolls the showcase to it */
.project { grid-area: 1 / 1; opacity: 0; pointer-events: none; max-width: 540px; }
.project.is-active { opacity: 1; pointer-events: auto; }
.project-title { font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); letter-spacing: -0.035em; line-height: 0.98; font-size: clamp(32px, 3.9vw, 62px); margin-bottom: 12px; }
/* A one-line subtitle under the title, in the serif, like the original portfolio's tagline */
.project-sub { font-family: var(--serif); font-style: italic; font-size: clamp(17px, 1.35vw, 21px); line-height: 1.35; color: var(--accent); margin-bottom: clamp(14px, 2.4vh, 22px); transition: color 1s; }
.project-title .word { overflow: hidden; vertical-align: top; padding-bottom: 0.1em; }
.project-title .ch { display: inline-block; }
.project-desc { font-size: clamp(15px, 1.12vw, 17px); color: var(--ink-2); line-height: 1.65; margin-bottom: clamp(18px, 3vh, 30px); }
.project-stats { display: flex; gap: clamp(24px, 4vw, 56px); margin-bottom: clamp(18px, 3vh, 28px); padding-top: 18px; border-top: 1px solid var(--line); }
.stat strong { display: block; font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); font-size: clamp(24px, 2.3vw, 36px); line-height: 1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.project .chips { margin-bottom: clamp(20px, 3.4vh, 34px); }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.project-open { display: inline-flex; align-items: center; gap: 12px; padding: 13px 22px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 500; background: var(--card); transition: background 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s; }
.project-open:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.project-case { text-decoration: none; color: inherit; background: #fecf6f; color: #0b0b0b; border-color: #fecf6f; font-weight: 600; }
.project-live { font-size: 14px; padding-bottom: 3px; border-bottom: 1px solid var(--line); transition: border-color 0.3s; }
.project-live::after { content: " ↗"; color: var(--accent); }
.project-live:hover { border-color: var(--accent); }
.project-peek { font-size: 14px; padding-bottom: 3px; border-bottom: 1px solid var(--line); color: var(--ink-2); transition: border-color 0.3s, color 0.3s; }
.project-peek::after { content: " +"; color: var(--accent); }
.project-peek:hover { border-color: var(--accent); color: var(--ink); }

/* "More" sits at the end of the project numbers and opens the smaller projects */
.projects-more { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); transition: border-color 0.3s, color 0.3s, background 0.3s; }
.projects-more b { font-weight: 500; color: var(--accent); }
.projects-more:hover { border-color: var(--accent); color: var(--ink); }
.project-pagination { align-items: center; }

/* ---------- Stage ---------- */
.showcase-stage { position: relative; aspect-ratio: 1; width: min(100%, 56vh); justify-self: center; }
.hud-ring { position: absolute; inset: -4%; width: 108%; height: 108%; overflow: visible; pointer-events: none; animation: spin 90s linear infinite; }
.ring-ticks { fill: none; stroke: color-mix(in srgb, var(--ink) 18%, transparent); stroke-width: 6; stroke-dasharray: 1 9.4; }
.ring-thin { fill: none; stroke: color-mix(in srgb, var(--ink) 8%, transparent); stroke-width: 1; }
.ring-text { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.3em; text-transform: uppercase; fill: color-mix(in srgb, var(--ink) 42%, transparent); }
.corner { position: absolute; width: 22px; height: 22px; border: 0 solid var(--accent); opacity: 0.8; transition: border-color 1s; pointer-events: none; }
.corner.tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.corner.tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- Prints ---------- */
.prints { position: absolute; inset: 0; pointer-events: none; }
.print-set { position: absolute; inset: 0; }
.print {
    --r: 0deg;
    position: absolute; margin: 0; padding: 7px 7px 0; border-radius: 6px;
    background: var(--paper); color: var(--paper-ink); box-shadow: var(--shadow);
    opacity: 0; transform: translateY(46px) rotate(calc(var(--r) * 2.2)) scale(0.9);
    transition: opacity 0.45s var(--ease), transform 0.7s var(--ease), box-shadow 0.4s, visibility 0s linear 0.7s;
    pointer-events: none; visibility: hidden;
}
.print::before { /* the pin */
    content: ""; position: absolute; top: -6px; left: 50%; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--accent) 50%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 60%, #000));
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.35); z-index: 2;
}
.print figcaption { font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em; padding: 7px 2px 8px; color: color-mix(in srgb, var(--paper-ink) 72%, transparent); line-height: 1.3; }
.print-body { position: relative; border-radius: 3px; overflow: hidden; background: #fff; }
.print-body img { width: 100%; height: auto; }
.print-a { --r: 4deg; top: -5%; right: -16%; width: 47%; }
.print-b { --r: -5deg; bottom: 4%; left: -18%; width: 43%; }
.print-c { --r: 3deg; bottom: -9%; right: -4%; width: 31%; }
.print-set.is-active .print { opacity: 1; transform: rotate(var(--r)); pointer-events: auto; visibility: visible; transition-delay: 0s; }
.print-set.is-active .print-a { transition-delay: 0.18s; }
.print-set.is-active .print-b { transition-delay: 0.3s; }
.print-set.is-active .print-c { transition-delay: 0.42s; }
.print-set.is-active .print:hover { transform: rotate(0deg) scale(1.08); z-index: 5; transition-delay: 0s; }
.print[data-zoom] { cursor: zoom-in; }
/* Phone screenshots: narrower, cropped to the top of the screen */
.print-tall .print-body img { aspect-ratio: 9 / 16; object-fit: cover; object-position: top; }
.print-b.print-tall { width: 27%; left: -12%; bottom: 0%; }
.print-c.print-tall { width: 23%; right: -6%; bottom: -8%; }

/* Browser frame */
.browser-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #ecebe7; border-bottom: 1px solid #dcdad4; }
.browser-bar i { width: 6px; height: 6px; border-radius: 50%; background: #cfcdc7; }
.browser-bar span { margin-left: 6px; font-family: var(--mono); font-size: 8.5px; color: #86858c; }
.browser img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }

/* UI sketches */
.mock { padding: 12px; font-size: 11px; line-height: 1.35; color: var(--paper-ink); background: #fcfcfb; }
.mock-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 11.5px; margin-bottom: 8px; }
.mock-head img { width: 20px; height: 20px; border-radius: 5px; }
.mock-tree li { display: flex; align-items: center; gap: 7px; padding: 6px 4px; border-top: 1px solid #ebeae6; }
.mock-tree .fold { width: 12px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, #e9e2d6); position: relative; }
.mock-tree em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 8px; padding: 2px 5px; border-radius: 4px; background: #f1efe9; color: #7a5a2a; }
.app-icon { display: grid; place-items: center; padding: 14px; background: #f4f3f0; }
.app-icon img { width: 64%; border-radius: 22%; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25); }

.mock-chat { display: flex; flex-direction: column; gap: 6px; background: #f7f6f3; min-height: 180px; }
.chat-head { display: flex; justify-content: space-between; font-size: 11px; padding-bottom: 6px; border-bottom: 1px solid #e7e6e1; }
.chat-head span { font-family: var(--mono); font-size: 8.5px; color: #6f9a5a; }
.bubble { max-width: 86%; padding: 6px 9px; border-radius: 10px; font-size: 10.5px; }
.bubble.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 80%, #fff); color: #fff; border-bottom-right-radius: 3px; }
.bubble.bot { align-self: flex-start; background: #fff; border: 1px solid #e7e6e1; border-bottom-left-radius: 3px; }
.bubble.typing { display: flex; gap: 3px; padding: 8px 10px; }
.bubble.typing i { width: 4px; height: 4px; border-radius: 50%; background: #b3b2ab; animation: dot 1.2s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }
.mock-wardrobe ul { display: flex; flex-wrap: wrap; gap: 4px; }
.mock-wardrobe li { padding: 3px 7px; border-radius: 999px; border: 1px solid #e2e0da; font-size: 9.5px; background: #fff; }
.mock-wardrobe li:nth-child(3n + 1) { background: color-mix(in srgb, var(--accent) 16%, #fff); border-color: color-mix(in srgb, var(--accent) 35%, #fff); }
.mock-pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 9px; text-transform: none; padding: 14px 10px; }
.mock-pipe span { padding: 3px 6px; border-radius: 4px; background: #efeee9; }
.mock-pipe span:last-child { background: color-mix(in srgb, var(--accent) 25%, #fff); }
.mock-pipe i { font-style: normal; color: #8f8e95; }

.compare .print-body { aspect-ratio: 1; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .compare-top { clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); }
.compare-tag { position: absolute; top: 6px; font-family: var(--mono); font-size: 8.5px; padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.92); color: #1d1d22; pointer-events: none; }
.compare-tag.left { left: 6px; }
.compare-tag.right { right: 6px; }
.dialog-gallery .compare-tag { font-size: 11px; top: 10px; }
.dialog-gallery .compare-tag.left { left: 10px; }
.dialog-gallery .compare-tag.right { right: 10px; }
.compare-handle::after { content: "↔"; position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #fff; color: #333; font-size: 11px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }

.mock-quiz { background: #fcfcfb; }
.quiz-step { font-size: 8.5px; color: #8a8990; text-transform: uppercase; margin-bottom: 6px; }
.quiz-step b { color: var(--accent); font-weight: 500; }
.quiz-q { font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); font-size: 13px; line-height: 1.25; margin-bottom: 8px; }
.mock-quiz li { padding: 5px 8px; margin-top: 4px; border-radius: 6px; border: 1px solid #e6e4de; font-size: 10px; display: flex; justify-content: space-between; }
.mock-quiz li.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, #fff); }
.mock-quiz li.is-picked::after { content: "✓"; color: var(--accent); }
.quiz-bar { display: block; height: 3px; border-radius: 2px; background: #e9e8e3; margin-top: 10px; overflow: hidden; }
.quiz-bar i { display: block; height: 100%; width: 50%; background: var(--accent); }
.mock-rule { text-transform: none; font-size: 9.5px; background: #1d1d22; color: #ecebe6; padding: 12px; }
.mock-rule p { display: flex; gap: 8px; padding: 2px 0; }
.mock-rule span { min-width: 64px; color: #9c9ba3; }
.mock-rule .ask { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #4a4a52; color: #fff; }
.mock-rule .ask span { color: var(--accent); }
.mock-branch { padding: 10px; background: #f7f6f3; }
.mock-branch svg { width: 100%; height: auto; }
.mock-branch path { fill: none; stroke: #c9c8c2; stroke-width: 2; stroke-linecap: round; }
.mock-branch circle { fill: #fff; stroke: #b3b2ab; stroke-width: 1.5; }
.mock-branch circle.on { fill: var(--accent); stroke: var(--accent); }

.projects-progress { position: absolute; left: 0; right: 0; bottom: 28px; }
.projects-progress::before, .projects-progress i { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); height: 1px; }
.projects-progress::before { background: var(--line); }
.projects-progress i { background: var(--accent); transform-origin: left; transform: scaleX(0); }
@media (min-width: 1101px) { .projects-progress::before, .projects-progress i { left: max(var(--gutter), 104px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) and (min-width: 901px) {
    .print-a { right: -8%; width: 42%; }
    .print-b { left: -10%; width: 40%; }
}
@media (max-width: 900px) {
    /* Follow the visible screen, so no strip is left empty when the browser toolbar hides */
    .projects-pin { justify-content: flex-start; padding: 72px 0 26px; height: 100dvh; }
    .projects-head { margin-bottom: 10px; }
    .showcase { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-items: start; gap: 6px; }
    .showcase-stage { order: -1; width: min(50vw, 24vh); margin: 12px auto 18px; }
    /* Fewer layers around the sculpture on small screens: no corner brackets */
    .corner { display: none; }
    /* Phones: one or two image-like frames sit beside the sculpture, without captions */
    .print:not([data-m]) { display: none; }
    .print[data-m] { padding: 4px 4px 0; border-radius: 5px; }
    .print[data-m] figcaption { display: none; }
    .print[data-m]::before { width: 8px; height: 8px; margin-left: -4px; top: -4px; }
    .print[data-m] .print-body { margin-bottom: 4px; }
    .print[data-m="r"] { top: -2%; bottom: auto; left: auto; right: calc((100% - 100vw) / 2 + 12px); width: 24vw; }
    .print[data-m="l"] { top: auto; bottom: -4%; right: auto; left: calc((100% - 100vw) / 2 + 12px); width: 21vw; }
    .print[data-m].print-portrait { width: 19vw; }
    .print[data-m] .browser-bar { display: none; }
    .print[data-m] .compare-tag, .print[data-m] .compare-handle::after { display: none; }
    .project-sub { font-size: 15px; margin-bottom: 8px; }
    .print[data-m].print-tall { width: 15vw; }
    .projects-more { margin-left: 4px; padding: 6px 8px; }
    .projects-more span { display: none; }
    .projects-title { font-size: 24px; }
    .project-title { font-size: clamp(24px, 6.8vw, 40px); margin-bottom: 6px; }
    /* main.js sets --lines to as many lines as fit above the buttons on this screen */
    .project-desc { font-size: 14px; line-height: 1.6; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: var(--lines, 4); -webkit-box-orient: vertical; overflow: hidden; }
    .project.no-chips .chips { display: none; }
    .project-stats { padding-top: 10px; margin-bottom: 12px; }
    .stat strong { font-size: 20px; margin-bottom: 4px; }
    .stat span { font-size: 12px; }
    .project .chips { margin-bottom: 14px; }
    .project-actions { gap: 16px; }
    .project-open { padding: 10px 16px; font-size: 13.5px; }
    .project .chips li:nth-child(n+4) { display: none; }
    .projects-progress { bottom: 12px; }
}
/* Short phone screens (browser toolbars included): drop the chips, which are
   listed in Quick look anyway, and shorten the copy so the links always show */
@media (max-width: 900px) and (max-height: 690px) {
    .projects-pin { padding-top: 66px; }
    .showcase-stage { width: min(46vw, 21vh); }
    .project-sub { font-size: 14px; }
    .project-stats { padding-top: 8px; margin-bottom: 10px; }
    .stat strong { font-size: 18px; }
}
@media (max-width: 560px) {
    .project-pagination { gap: 2px; }
    .project-pagination button { width: 29px; }
    .projects-head { gap: 12px; }
    .projects-title { flex: none; }
    .projects-title { font-size: 22px; }
    .projects-title sup { display: none; }
}
@media (max-height: 760px) and (min-width: 901px) {
    .project-title { font-size: clamp(30px, 3.5vw, 54px); }
    .project-desc { font-size: 15px; }
}

/* Image slot placeholder inside a print */
.print .slot-ph { aspect-ratio: 4 / 5; }
.print.print-portrait { --r: 5deg; top: -7%; right: -9%; width: 29%; }
/* A cut-out character on a soft studio backdrop instead of a cropped photo */
.print.print-portrait.has-img .print-body {
    background: radial-gradient(90% 70% at 50% 40%, #ffffff, #f1e6ea 70%, #e7d6dc);
}
.print.print-portrait.has-img .print-body img { aspect-ratio: 5 / 7; object-fit: contain; object-position: center bottom; padding: 8px 6px 0; }
.print.has-img .print-body img { aspect-ratio: 4 / 5; object-fit: cover; }
