/* =========================================================================
   HACHIMITSUKI — Moon & Honey · shared stylesheet
   Editorial luxury × mystical-celestial-apothecary
   Loaded from every page after Tailwind CDN.
   ========================================================================= */

/* ===== Keyframes ===== */
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(-0.5deg); }
    50%      { transform: translateY(-14px) rotate(0.5deg); }
}
@keyframes twinkle {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}
@keyframes drip {
    0%   { transform: translateY(-8px) scaleY(0.9); opacity: 0; }
    15%  { opacity: 1; }
    55%  { transform: translateY(22px) scaleY(1.15); opacity: 1; }
    100% { transform: translateY(52px) scaleY(0.4); opacity: 0; }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes maskReveal {
    from { -webkit-mask-position: 100% 0; mask-position: 100% 0; opacity: 0; }
    to   { -webkit-mask-position: 0 0;    mask-position: 0 0;    opacity: 1; }
}
@keyframes scrollPulse {
    0%, 100% { transform: scaleY(0.4); transform-origin: top; opacity: 0.5; }
    50%      { transform: scaleY(1);   transform-origin: top; opacity: 1; }
}

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
    font-size: 18px; /* bumped from 16 → 18 to scale rem-based sizing globally */
}
body {
    background: #0a0e1f;
    color: #e7e4d7;
    font-family: 'Cormorant Garamond', 'Shippori Mincho', Georgia, serif;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    cursor: none;
    line-height: 1.75;
}
p, li { font-feature-settings: "palt" 1; }

/* ===== Focus styles (keyboard accessibility) =====
   We hide the OS cursor via cursor: none + custom dot.
   Keyboard users still need a visible focus indicator. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(212,168,67,0.85);
    outline-offset: 4px;
    border-radius: 2px;
}

/* ===== Atmospheric layers ===== */
.layer-stars {
    position: fixed; inset: 0; pointer-events: none; z-index: 1;
    background-image:
        radial-gradient(1.4px 1.4px at 12% 18%, rgba(251,233,181,0.85), transparent 60%),
        radial-gradient(1px 1px at 32% 28%, rgba(255,255,255,0.5), transparent 60%),
        radial-gradient(1.6px 1.6px at 65% 12%, rgba(212,168,67,0.75), transparent 60%),
        radial-gradient(1px 1px at 85% 35%, rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(1.5px 1.5px at 48% 52%, rgba(251,233,181,0.55), transparent 60%),
        radial-gradient(1px 1px at 18% 70%, rgba(255,255,255,0.4), transparent 60%),
        radial-gradient(1.4px 1.4px at 72% 78%, rgba(212,168,67,0.6), transparent 60%),
        radial-gradient(1px 1px at 92% 88%, rgba(251,233,181,0.4), transparent 60%),
        radial-gradient(1.5px 1.5px at 38% 92%, rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(1.2px 1.2px at 55% 22%, rgba(251,233,181,0.45), transparent 60%),
        radial-gradient(1.8px 1.8px at 8% 45%, rgba(212,168,67,0.55), transparent 60%),
        radial-gradient(1.4px 1.4px at 95% 55%, rgba(255,255,255,0.6), transparent 60%);
    background-size: 100vw 100vh;
    animation: twinkle 6s ease-in-out infinite;
    opacity: 0.85;
}
.layer-grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 2;
    opacity: 0.08; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.honey-thread {
    position: fixed; top: 0; bottom: 0; left: clamp(1rem, 4vw, 3rem);
    width: 1px; z-index: 3; pointer-events: none;
    background: linear-gradient(180deg, transparent 0%, rgba(212,168,67,0.55) 12%, rgba(212,168,67,0.2) 50%, rgba(212,168,67,0.55) 88%, transparent 100%);
}
.honey-thread::before {
    content: ''; position: absolute; left: -3px; top: 8%;
    width: 7px; height: 7px; border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, #fbe9b5, #d4a843 70%, #6b5018);
    box-shadow: 0 0 12px rgba(212,168,67,0.7), 0 0 28px rgba(212,168,67,0.35);
}

/* ===== Cursor ===== */
.cursor-dot {
    position: fixed; top: 0; left: 0; pointer-events: none; z-index: 1000;
    width: 8px; height: 8px; border-radius: 999px;
    background: radial-gradient(circle at 35% 35%, #fbe9b5, #d4a843 60%, #6b5018);
    box-shadow: 0 0 10px rgba(212,168,67,0.6), 0 0 24px rgba(212,168,67,0.25);
    transform: translate(-50%, -50%);
    transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
    mix-blend-mode: screen;
}
.cursor-halo {
    position: fixed; top: 0; left: 0; pointer-events: none; z-index: 999;
    width: 44px; height: 44px; border-radius: 999px;
    border: 1px solid rgba(212,168,67,0.5);
    transform: translate(-50%, -50%);
    transition: transform 0.22s cubic-bezier(0.2,0.8,0.2,1), width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}
@media (hover: none) {
    body { cursor: auto; }
    .cursor-dot, .cursor-halo { display: none; }
}

/* ===== Reveal on scroll ===== */
[data-reveal] {
    opacity: 0;
    transform: translateY(34px);
    filter: blur(6px);
    transition: opacity 1.2s cubic-bezier(0.2,0.8,0.2,1), transform 1.2s cubic-bezier(0.2,0.8,0.2,1), filter 1.0s ease;
    transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in {
    opacity: 1; transform: translateY(0); filter: blur(0);
}

/* ===== Typography utilities ===== */
.display-italic {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 0.92;
    background: linear-gradient(180deg, #fbe9b5 0%, #d4a843 60%, #9a7625 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 1px 40px rgba(212,168,67,0.18);
}
.display-italic.reveal-mask {
    -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent 95%);
    mask-image: linear-gradient(90deg, #000 30%, transparent 95%);
    -webkit-mask-size: 220% 100%;
    mask-size: 220% 100%;
    animation: maskReveal 1.8s 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}
.display-jp {
    font-family: 'Shippori Mincho', serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.4;
    color: #f3ead4;
}
.annot {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: rgba(212,168,67,0.9);
    font-weight: 500;
}
.annot-sm {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.75rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: rgba(231,228,215,0.7);
    font-weight: 500;
}
.roman {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    color: rgba(212,168,67,0.65);
}

/* ===== Decorative elements ===== */
.honey-drop {
    display: inline-block;
    width: 14px; height: 22px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 22'><defs><linearGradient id='d' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23fbe9b5'/><stop offset='0.6' stop-color='%23d4a843'/><stop offset='1' stop-color='%239a7625'/></linearGradient></defs><path d='M7 0 C7 0 0 12 0 16 a7 7 0 0 0 14 0 C14 12 7 0 7 0 z' fill='url(%23d)'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 8px rgba(212,168,67,0.45));
}
.hex-mark {
    background-image: url('assets/hex-moon-logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 12px rgba(212,168,67,0.45));
}

/* ===== Navigation ===== */
.nav-link {
    position: relative;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(231,228,215,0.78);
    padding: 0.35rem 0.1rem;
    transition: color 0.3s ease;
}
.nav-link::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4a843, transparent);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.2,0.8,0.2,1);
}
.nav-link:hover, .nav-link.active { color: #fbe9b5; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ===== Buttons / CTA ===== */
.cta-primary {
    display: inline-flex; align-items: baseline; gap: 0.6rem;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.35rem;
    font-weight: 600;
    color: #0a0e1f;
    background: linear-gradient(135deg, #f0d28a 0%, #d4a843 55%, #9a7625 100%);
    padding: 0.95rem 2.5rem 1.05rem;
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(212,168,67,0.32), inset 0 1px 0 rgba(255,255,255,0.45);
    transition: transform 0.4s cubic-bezier(0.2,0.8,0.2,1), box-shadow 0.4s ease;
    position: relative; overflow: hidden;
    cursor: none;
}
.cta-primary::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.45) 50%, transparent 65%);
    background-size: 200% 100%;
    animation: shimmer 4s ease-in-out infinite;
}
.cta-primary > * { position: relative; z-index: 1; }
.cta-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 60px rgba(212,168,67,0.45), inset 0 1px 0 rgba(255,255,255,0.55);
}
.cta-ghost {
    display: inline-flex; align-items: baseline; gap: 0.5rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(251,233,181,0.9);
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(212,168,67,0.45);
    transition: color 0.3s ease, border-color 0.3s ease, padding-right 0.4s ease;
}
.cta-ghost:hover {
    color: #fbe9b5;
    border-color: #d4a843;
    padding-right: 0.5rem;
}
.btn-back {
    display: inline-flex; align-items: baseline; gap: 0.5rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(231,228,215,0.7);
    padding: 0.5rem 0;
    transition: color 0.3s ease, padding-left 0.3s ease;
}
.btn-back:hover { color: #fbe9b5; padding-left: 0.5rem; }

/* ===== Tag chip ===== */
.chip {
    display: inline-flex; align-items: center;
    padding: 0.35rem 0.95rem;
    border: 1px solid rgba(212,168,67,0.4);
    color: rgba(251,233,181,0.9);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    border-radius: 999px;
    background: rgba(212,168,67,0.06);
}

/* ===== Margin notes ===== */
.margin-note {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(231,228,215,0.78);
    position: relative;
    padding-left: 1.25rem;
}
.margin-note::before {
    content: '⌖'; position: absolute; left: 0; top: 0.05em;
    color: rgba(212,168,67,0.8);
    font-size: 0.85rem;
}

/* ===== Profile / photo frame ===== */
.profile-frame {
    position: relative; aspect-ratio: 4/5;
    background: url('assets/honey-jar-moon.png') center/cover no-repeat;
    border-radius: 4px;
    box-shadow: 0 40px 90px rgba(0,0,0,0.65), 0 0 70px rgba(212,168,67,0.18);
}
.profile-frame::before {
    content: ''; position: absolute; inset: -10px;
    border: 1px solid rgba(212,168,67,0.4);
    pointer-events: none;
}
.profile-frame::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(10,14,31,0.7) 100%);
    pointer-events: none;
}

/* ===== Ledger ===== */
.ledger-row {
    display: grid;
    grid-template-columns: 60px 70px 1fr auto;
    gap: 1.5rem; align-items: center;
    padding: 2rem 0;
    border-top: 1px solid rgba(212,168,67,0.18);
    position: relative;
    transition: padding-left 0.4s cubic-bezier(0.2,0.8,0.2,1);
    cursor: none;
    text-decoration: none;
    color: inherit;
}
.ledger-row:last-of-type { border-bottom: 1px solid rgba(212,168,67,0.18); }
.ledger-row::before {
    content: ''; position: absolute; left: 0; top: 50%;
    width: 0; height: 1px;
    background: linear-gradient(90deg, #d4a843, transparent);
    transform: translateY(-50%);
    transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1);
}
.ledger-row:hover { padding-left: 24px; }
.ledger-row:hover::before { width: 18px; }
.ledger-row:hover .ledger-no { color: #fbe9b5; }
.ledger-row:hover .ledger-title { transform: translateX(4px); color: #fbe9b5; }
.ledger-row:hover .ledger-hex { transform: rotate(8deg) scale(1.08); filter: drop-shadow(0 0 22px rgba(212,168,67,0.7)); }
.ledger-row:hover .ledger-arrow { transform: translateX(8px); color: #fbe9b5; }

.ledger-no {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.85rem;
    font-weight: 400;
    color: rgba(212,168,67,0.65);
    transition: color 0.3s ease;
}
.ledger-hex {
    width: 64px; height: 64px;
    transition: transform 0.5s cubic-bezier(0.2,0.8,0.2,1), filter 0.5s ease;
}
.ledger-title {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(1.75rem, 2.8vw, 2.4rem);
    font-weight: 500;
    color: #f3ead4;
    line-height: 1.1;
    transition: transform 0.4s ease, color 0.4s ease;
}
.ledger-arrow {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.65rem;
    color: rgba(212,168,67,0.8);
    transition: transform 0.4s cubic-bezier(0.2,0.8,0.2,1), color 0.4s ease;
}

/* ===== Interstitial bands ===== */
.interstitial {
    height: 240px;
    position: relative; overflow: hidden;
    isolation: isolate;
}
.interstitial::before {
    content: ''; position: absolute; inset: 0;
    background: url('assets/night-sky.png') center/cover no-repeat;
    transform: scale(1.08);
}
.interstitial::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, #0a0e1f 0%, rgba(10,14,31,0.4) 35%, rgba(10,14,31,0.4) 65%, #0a0e1f 100%);
}
.interstitial > * { position: relative; z-index: 1; }
.drip-pair {
    position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 22px;
}
.drip-pair .honey-drop {
    animation: drip 4.5s ease-in infinite;
}
.drip-pair .honey-drop:nth-child(1) { animation-delay: 0s; }
.drip-pair .honey-drop:nth-child(2) { animation-delay: 1.2s; transform: scale(0.7); }
.drip-pair .honey-drop:nth-child(3) { animation-delay: 2.4s; transform: scale(0.9); }

/* ===== Scroll cue ===== */
.scroll-cue {
    display: inline-flex; flex-direction: column; align-items: center; gap: 0.4rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: rgba(212,168,67,0.78);
}
.scroll-cue .bar {
    width: 1px; height: 56px;
    background: linear-gradient(180deg, rgba(212,168,67,0.05), #d4a843 50%, rgba(212,168,67,0.05));
    animation: scrollPulse 2.4s ease-in-out infinite;
}

/* ===== Signature rows (footer) ===== */
.sig-row {
    display: grid; grid-template-columns: 80px 1fr auto; gap: 1.5rem;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid rgba(212,168,67,0.15);
    text-decoration: none;
    color: inherit;
}
.sig-row:last-child { border-bottom: 1px solid rgba(212,168,67,0.15); }
.sig-row .label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: rgba(212,168,67,0.8);
}
.sig-row .handle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.55rem;
    color: #f3ead4;
    transition: color 0.3s ease;
}
.sig-row:hover .handle { color: #fbe9b5; }

/* ===== Instruction step (doc pages) ===== */
.step-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 2rem; align-items: start;
    padding: 2.75rem 0;
    border-top: 1px solid rgba(212,168,67,0.2);
    position: relative;
}
.step-row:last-of-type { border-bottom: 1px solid rgba(212,168,67,0.2); }
.step-hex {
    width: 64px; height: 64px;
    background-image: url('assets/hex-moon-logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 14px rgba(212,168,67,0.5));
    display: grid; place-items: center;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.75rem;
    color: #0a0e1f;
    text-shadow: 0 0 6px rgba(251, 233, 181, 0.9);
}
.step-body h3 {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.6rem, 2.3vw, 2rem);
    color: #f3ead4;
    margin: 0 0 0.75rem;
    line-height: 1.2;
}
.step-body p {
    color: rgba(231,228,215,0.85);
    line-height: 1.95;
    font-size: 1.1rem;
    font-weight: 500;
}
.step-body code {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
    background: rgba(212,168,67,0.1);
    color: #fbe9b5;
    padding: 0.18em 0.5em;
    border-radius: 3px;
    border: 1px solid rgba(212,168,67,0.3);
}

/* ===== Download / hero CTA box (doc pages) ===== */
.relic-box {
    position: relative;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3rem);
    border: 1px solid rgba(212,168,67,0.35);
    border-radius: 6px;
    text-align: center;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(180deg, rgba(20,26,46,0.85) 0%, rgba(10,14,31,0.95) 100%);
}
.relic-box::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(212,168,67,0.18), transparent 70%);
    z-index: -1;
}
.relic-box::after {
    content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 60px; height: 1px;
    background: linear-gradient(90deg, transparent, #d4a843, transparent);
}
.relic-box .honey-drop {
    margin: 0 auto 1.25rem;
    display: block;
    animation: floatSlow 6s ease-in-out infinite;
}

/* ===== Reduce motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .display-italic.reveal-mask {
        opacity: 1;
        -webkit-mask-image: none;
        mask-image: none;
    }
    [data-reveal] { opacity: 1; transform: none; filter: none; }
}
