/* kanojo.name -- neon ikebana / night herbarium cabinet */

:root {
    --vellum: #F4EFE6;
    --sumi: #0E0E12;
    --cream: #FAF6EC;
    --magenta: #FF2E93;
    --lime: #C6FF3D;
    --violet: #7A3CFF;
    --tea: #D9DCC4;
    --hairline: #1F1F26;
    --indigo-ink: #1F1F26;

    --w: clamp(360, calc(360 + (100vw - 320px) / 12), 520);
    --scroll: 0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--vellum);
    color: var(--sumi);
    font-family: 'Inter', sans-serif;
    font-variation-settings: 'wght' clamp(360, calc(360 + 80 * var(--scroll)), 440);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: radial-gradient(rgba(14,14,18,0.018) 1px, transparent 1px);
    background-size: 3px 3px;
}

/* ---------- Header ---------- */
.cabinet-header {
    height: clamp(64px, 8vh, 96px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(48px, 6vw, 96px);
    border-bottom: 1px solid var(--hairline);
    position: relative;
    z-index: 4;
    background: var(--vellum);
}

.wordmark {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.iris-glyph {
    align-self: center;
    flex: 0 0 auto;
}

.iris-stroke {
    animation: iris-pulse 60s linear infinite;
}

@keyframes iris-pulse {
    0%, 92% { stroke: #0E0E12; filter: none; }
    94%, 99% { stroke: #FF2E93; filter: drop-shadow(0 0 6px #FF2E93); }
    100% { stroke: #0E0E12; filter: none; }
}

.wordmark-text {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'opsz' 144, 'SOFT' 50, 'wght' 360;
    font-size: clamp(2rem, 5vw, 3.4rem);
    letter-spacing: -0.02em;
    line-height: 1;
}

.wordmark-suffix {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hairline);
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.meta-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hairline);
    opacity: 0.7;
}

/* ---------- Margin Index ---------- */
.margin-index {
    position: fixed;
    left: clamp(12px, 2vw, 32px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.margin-index ul {
    list-style: none;
    writing-mode: vertical-rl;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 1px solid var(--hairline);
    padding-left: 6px;
}

.margin-index li {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--hairline);
    letter-spacing: 0.4em;
    padding: 4px 0;
    cursor: pointer;
    transition: color 200ms ease, transform 200ms ease;
}

.margin-index li:hover,
.margin-index li.active {
    color: var(--magenta);
    transform: translateX(-2px);
}

/* ---------- Exhibition / Intro ---------- */
.exhibition {
    position: relative;
    z-index: 2;
}

.intro-column {
    max-width: 640px;
    margin: 0 auto;
    padding: clamp(48px, 9vh, 110px) clamp(48px, 6vw, 96px) clamp(8px, 2vh, 24px);
}

.intro-lead {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.6vw, 2.1rem);
    line-height: 1.4;
    margin-bottom: 1.1rem;
}

.intro-body {
    font-size: clamp(0.92rem, 1.05vw, 1.02rem);
    line-height: 1.7;
    max-width: 56ch;
    margin-bottom: 1.4rem;
    color: var(--sumi);
}

.intro-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--hairline);
    opacity: 0.65;
}

/* ---------- Card Grid ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(20px, 2.4vw, 36px);
    padding: clamp(48px, 8vh, 120px) clamp(48px, 6vw, 96px);
    align-items: start;
}

.card-grid > .specimen-card:nth-child(even) {
    transform: translateY(28px);
}

.specimen-card {
    background: var(--cream);
    border: 1px solid var(--hairline);
    border-radius: 0;
    padding: clamp(20px, 1.8vw, 32px) clamp(18px, 1.6vw, 28px);
    aspect-ratio: 3 / 4;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    cursor: pointer;
    outline: 1px solid transparent;
    outline-offset: -1px;
    transition: outline-color 320ms ease, transform 280ms cubic-bezier(0.16,1,0.3,1);
    clip-path: inset(0 100% 0 0);
    position: relative;
}

.specimen-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(14,14,18,0.04) 0 1px, transparent 1px 8px);
    opacity: 1;
    transition: opacity 720ms cubic-bezier(0.16,1,0.3,1);
}

.specimen-card.revealed {
    clip-path: inset(0 0 0 0);
    transition: clip-path 720ms cubic-bezier(0.16,1,0.3,1);
    transition-delay: calc(var(--i, 0) * 60ms);
}

.specimen-card.revealed::before { opacity: 0; }

.specimen-card:hover {
    outline-color: var(--magenta);
}

.specimen-card.nudge {
    transform: translateX(-4px) !important;
}

.card-glyph-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.card-glyph {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}

.card-glyph path {
    transition: stroke 240ms ease-out;
}

.specimen-card:hover .card-glyph path {
    stroke: var(--magenta);
}

.specimen-card.spark-decay .card-glyph path {
    animation: spark-decay 800ms ease-out forwards;
}

@keyframes spark-decay {
    0% { stroke: #FF2E93; }
    45% { stroke: #7A3CFF; }
    100% { stroke: #1F1F26; }
}

.fresh-flag {
    width: 12px;
    height: 1px;
    background: var(--lime);
}

.card-glyph-spacer { width: 12px; height: 1px; }

.card-rule {
    height: 1px;
    background: var(--hairline);
    width: 100%;
    opacity: 0.5;
}

.card-binomial {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.05rem, 1.6vw, 1.4rem);
    letter-spacing: 0.01em;
    color: var(--sumi);
}

.card-name {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'opsz' 110, 'SOFT' 40, 'wght' var(--w);
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin-top: auto;
}

.card-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hairline);
}

.specimen-card.is-fresh .card-tag { color: var(--lime); }

.card-etym {
    font-size: clamp(0.82rem, 0.95vw, 0.92rem);
    line-height: 1.55;
    color: var(--sumi);
    opacity: 0.85;
}

.card-grid.dimmed > .specimen-card:not(.selected) {
    opacity: 0.3;
    transition: opacity 1.2s ease;
}

.specimen-card.selected {
    visibility: hidden;
}

/* ---------- Ink wash overlay ---------- */
.ink-wash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    background: radial-gradient(ellipse at left, rgba(122,60,255,0.10), transparent 70%);
}

.ink-wash.sweep {
    animation: ink-sweep 1.2s ease forwards;
}

@keyframes ink-sweep {
    0% { opacity: 0; transform: translateX(-30%); }
    40% { opacity: 1; }
    100% { opacity: 0; transform: translateX(10%); }
}

/* ---------- Reading Pane ---------- */
.reading-pane {
    position: fixed;
    inset: 0;
    z-index: 8;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vh, 64px);
    background: rgba(244,239,230,0.82);
}

.reading-pane.open {
    display: flex;
}

.reading-inner {
    display: flex;
    gap: 0;
    width: min(1100px, 92vw);
    max-height: 80vh;
    background: var(--cream);
    border: 1px solid var(--hairline);
    animation: pane-in 480ms cubic-bezier(0.16,1,0.3,1);
}

@keyframes pane-in {
    0% { opacity: 0; transform: scale(0.96) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.reading-card {
    flex: 0 0 44%;
    padding: clamp(28px, 3vw, 48px);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: var(--vellum);
}

.reading-rule {
    width: 1px;
    background: var(--hairline);
    flex: 0 0 1px;
}

.reading-classification {
    flex: 1 1 auto;
    padding: clamp(28px, 3vw, 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reading-classification h3 {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.3rem, 2vw, 1.7rem);
}

.reading-classification dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.2rem;
    font-size: 0.9rem;
}

.reading-classification dt {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hairline);
    opacity: 0.7;
    align-self: center;
}

.reading-classification dd {
    font-family: 'Inter', sans-serif;
}

.reading-classification p {
    font-size: clamp(0.9rem, 1.05vw, 1rem);
    line-height: 1.7;
}

.reading-card .card-name {
    font-size: clamp(2.4rem, 4vw, 3.4rem);
}

.reading-close {
    position: absolute;
    top: clamp(20px, 4vh, 40px);
    right: clamp(20px, 4vw, 48px);
    background: none;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sumi);
    cursor: pointer;
    padding: 6px 8px;
}

.reading-close:hover { color: var(--magenta); }

/* ---------- Footer press band ---------- */
.press-band {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--hairline);
    padding: 0;
    background: var(--vellum);
}

.press-stem {
    display: block;
    width: 100%;
    height: 80px;
}

.stem-sap {
    stroke-dasharray: 20 9999;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 4px #FF2E93);
    animation: sap-travel 18s linear infinite;
}

@keyframes sap-travel {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -9999; }
}

.press-caption {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 12px clamp(48px, 6vw, 96px) 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hairline);
    opacity: 0.7;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .margin-index { display: none; }
    .reading-inner { flex-direction: column; max-height: 86vh; overflow-y: auto; }
    .reading-card { flex: 0 0 auto; }
    .reading-rule { width: 100%; height: 1px; flex: 0 0 1px; }
    .header-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .specimen-card { clip-path: inset(0 0 0 0); transition: opacity 200ms ease; opacity: 0; }
    .specimen-card.revealed { opacity: 1; transition: opacity 200ms ease; }
    .specimen-card::before { display: none; }
    .iris-stroke { animation: none; stroke: #0E0E12; }
    .stem-sap { animation: none; stroke-dashoffset: -480; }
    .ink-wash.sweep { animation: none; }
    body { font-variation-settings: 'wght' 400; }
}
