/* ==========================================================
   AMAMIYA.MONSTER  --  Corporate Monochrome Monolith
   Palette : aged rice paper, engraved graphite, single crimson
   Fonts   : IBM Plex Mono (all weights)
   ========================================================== */

:root {
    --paper:           #F6F2E9; /* Aged Rice Paper       */
    --linen:           #E6DFD0; /* Linen Subtle          */
    --graphite:        #3A3833; /* Engraved Graphite     */
    --ash:             #5C5852; /* Ash Slate             */
    --ink:             #1A1916; /* Ink Monolith          */
    --stone:           #B0A99B; /* Faded Stone           */
    --crimson:         #9C2A1F; /* Cultural Crimson      */

    --rhythm: 32px;
    --outer-margin: 12vw;
    --section-gap: 12vh;

    --ease-monolith: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html,
body {
    background: var(--paper);
    color: var(--ink);
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
    background:
        radial-gradient(ellipse at 18% 8%, rgba(176, 169, 155, 0.22), transparent 55%),
        radial-gradient(ellipse at 88% 92%, rgba(176, 169, 155, 0.18), transparent 60%),
        radial-gradient(ellipse at 92% 12%, rgba(156, 42, 31, 0.04), transparent 45%),
        var(--paper);
}

/* ---------- Paper-aged noise overlay ---------- */
.paper-texture {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9000;
    mix-blend-mode: multiply;
    opacity: 0;
    transition: opacity 2s var(--ease-monolith);
}

.paper-texture.is-revealed {
    opacity: 0.65;
}

.paper-stain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8500;
    background:
        radial-gradient(circle at 4% 2%, rgba(124, 92, 50, 0.10), transparent 18%),
        radial-gradient(circle at 96% 4%, rgba(124, 92, 50, 0.08), transparent 22%),
        radial-gradient(circle at 2% 98%, rgba(124, 92, 50, 0.12), transparent 20%),
        radial-gradient(circle at 98% 96%, rgba(124, 92, 50, 0.09), transparent 18%),
        radial-gradient(circle at 38% 70%, rgba(176, 169, 155, 0.10), transparent 6%),
        radial-gradient(circle at 76% 30%, rgba(176, 169, 155, 0.09), transparent 5%);
    mix-blend-mode: multiply;
    opacity: 0;
    transition: opacity 2.2s var(--ease-monolith);
}

.paper-stain.is-revealed {
    opacity: 1;
}

/* ---------- Folio frame : persistent corner ciphers ---------- */
.folio-frame {
    position: fixed;
    inset: 28px clamp(20px, 4vw, 64px);
    pointer-events: none;
    z-index: 9500;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ash);
    font-variant-numeric: tabular-nums;
}

.folio-mark {
    position: absolute;
    white-space: nowrap;
    transition: color 600ms var(--ease-monolith);
}

.folio-mark--top-left    { top: 0;    left: 0;  }
.folio-mark--top-right   { top: 0;    right: 0; }
.folio-mark--bottom-left { bottom: 0; left: 0;  }
.folio-mark--bottom-right { bottom: 0; right: 0; }

#cipherTag {
    cursor: default;
    pointer-events: auto;
}

#cipherTag:hover,
#cipherTag.is-flicker {
    color: var(--crimson);
}

/* ---------- Plate (section) ---------- */
.plate {
    position: relative;
    min-height: 100vh;
    padding: var(--section-gap) var(--outer-margin);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.plate--hero       { min-height: 130vh; }
.plate--cultural   { min-height: 120vh; background: linear-gradient(180deg, var(--paper), var(--linen) 80%, var(--paper)); }
.plate--statement  { min-height: 120vh; }
.plate--civic      { min-height: 120vh; background: linear-gradient(180deg, var(--paper), var(--linen) 70%, var(--paper)); }
.plate--colophon   { min-height: 100vh; }

.plate-inner {
    width: 100%;
    max-width: 1280px;
    position: relative;
    z-index: 1;
    transform: scale(0.94);
    opacity: 0;
    transition:
        transform 1.4s var(--ease-monolith),
        opacity   1.4s var(--ease-monolith);
    transform-origin: 50% 45%;
}

.plate.is-in-view .plate-inner {
    transform: scale(1);
    opacity: 1;
}

.plate-label {
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ash);
    margin-bottom: calc(var(--rhythm) * 2);
}

/* ---------- Rules (engraved lines) ---------- */
.rule {
    display: inline-block;
    height: 1.5px;
    background: var(--graphite);
    position: relative;
    box-shadow: 0 1px 0 rgba(176, 169, 155, 0.35);
}

.rule--short { width: 36px; }
.rule--long  { width: 100%; display: block; margin: 18px 0; }

/* ============ HERO PLATE ============ */
.plate--hero .plate-inner {
    text-align: center;
}

.wordmark {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 700;
    font-size: clamp(72px, 14vw, 220px);
    letter-spacing: 0.02em;
    color: var(--graphite);
    line-height: 0.96;
    margin: clamp(32px, 6vh, 72px) 0 clamp(24px, 4vh, 48px);
    display: inline-block;
    transform-origin: 50% 50%;
    transition: transform 600ms var(--ease-monolith);
    cursor: default;
    will-change: transform;
    text-shadow:
        0 0 0 transparent,
        1px 1px 0 rgba(58, 56, 51, 0.06),
        -1px -1px 0 rgba(246, 242, 233, 0.45);
}

.wordmark .letter {
    display: inline-block;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 700ms var(--ease-monolith), transform 700ms var(--ease-monolith);
}

.wordmark.is-engraved .letter {
    opacity: 1;
    transform: scale(1);
}

.sub-cipher {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ash);
    margin-bottom: calc(var(--rhythm) * 2);
}

.typewriter::after {
    content: "";
    display: inline-block;
    width: 0.55em;
    height: 1em;
    margin-left: 4px;
    background: var(--ash);
    vertical-align: -0.12em;
    animation: caretBlink 1.05s steps(2, end) infinite;
}

.typewriter.is-done::after {
    animation: none;
    opacity: 0;
}

@keyframes caretBlink {
    50% { opacity: 0; }
}

.hero-foot {
    margin-top: clamp(48px, 8vh, 96px);
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ash);
}

.hero-foot-text {
    display: block;
    margin-top: 14px;
}

/* ============ SEAL (cultural crimson) ============ */
.seal {
    position: absolute;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    z-index: 2;
    opacity: 0;
    transform: scale(1.4) rotate(-8deg);
    transition: transform 1.2s var(--ease-monolith), opacity 1.2s var(--ease-monolith);
    cursor: default;
}

.plate.is-in-view .seal {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    animation: sealBreath 4.5s ease-in-out 1.2s infinite;
}

.seal:hover {
    animation: sealPulse 900ms ease-in-out infinite;
}

.seal-ring {
    position: absolute;
    inset: 0;
    border: 1.8px solid var(--crimson);
    border-radius: 50%;
}

.seal-ring::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(156, 42, 31, 0.45);
    border-radius: 50%;
}

.seal-mark {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 700;
    font-size: 28px;
    color: var(--crimson);
    line-height: 1;
    transform: translateY(1px);
    text-shadow: 0 0 0 var(--crimson);
}

.seal--hero       { right: clamp(48px, 8vw, 140px); bottom: clamp(64px, 10vh, 140px); }
.seal--cultural   { right: clamp(48px, 8vw, 140px); bottom: clamp(60px, 9vh, 110px); }
.seal--statement  { right: clamp(48px, 8vw, 140px); top:    clamp(60px, 10vh, 110px); }
.seal--civic      { right: clamp(48px, 8vw, 140px); bottom: clamp(60px, 9vh, 110px); }
.seal--colophon   { left: 50%; bottom: clamp(64px, 10vh, 140px); transform: translateX(-50%) scale(1.4) rotate(-8deg); }

.plate.is-in-view .seal--colophon {
    transform: translateX(-50%) scale(1) rotate(0deg);
}

@keyframes sealBreath {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.06); }
}

@keyframes sealPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%      { transform: scale(1.06) rotate(0deg); }
}

.seal--colophon:hover {
    animation: sealPulseCenter 900ms ease-in-out infinite;
}

@keyframes sealPulseCenter {
    0%, 100% { transform: translateX(-50%) scale(1) rotate(0deg); }
    50%      { transform: translateX(-50%) scale(1.06) rotate(0deg); }
}

/* ============ CULTURAL PLATE ============ */
.plate--cultural .plate-inner,
.plate--civic    .plate-inner {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: var(--section-gap);
    justify-items: center;
    text-align: center;
}

.motif-wrap {
    width: clamp(280px, 42vw, 560px);
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
}

.motif-wrap--wide {
    width: clamp(360px, 60vw, 820px);
    aspect-ratio: 5 / 3;
}

.motif {
    width: 100%;
    height: 100%;
    overflow: visible;
    transition: transform 600ms var(--ease-monolith), filter 320ms var(--ease-monolith);
    cursor: default;
    will-change: transform;
}

.motif-strokes path,
.motif-strokes circle {
    stroke-dasharray: var(--len, 1000);
    stroke-dashoffset: var(--len, 1000);
    transition: stroke-width 320ms var(--ease-monolith);
}

.plate.is-in-view .motif-strokes path,
.plate.is-in-view .motif-strokes circle {
    animation: drawLine 1.6s var(--ease-monolith) forwards;
}

.motif-wrap:hover .motif-strokes path,
.motif-wrap:hover .motif-strokes circle {
    stroke-width: 2.2;
}

.motif-wrap:hover .motif {
    filter: drop-shadow(0 0 14px rgba(156, 42, 31, 0.14));
}

@keyframes drawLine {
    0%   { stroke-dashoffset: var(--len, 1000); }
    100% { stroke-dashoffset: 0; }
}

/* Body blocks */
.body-block {
    max-width: 680px;
    text-align: left;
    color: var(--ink);
    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.75;
}

.body-block--civic {
    max-width: 760px;
}

.body-line {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 800ms var(--ease-monolith), transform 800ms var(--ease-monolith);
    margin-bottom: 1em;
}

.body-line:last-child {
    margin-bottom: 0;
}

.plate.is-in-view .body-line.is-shown {
    opacity: 1;
    transform: translateY(0);
}

.signature-strip {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ash);
    text-align: center;
}

/* ============ STATEMENT PLATE ============ */
.plate--statement .plate-inner {
    text-align: center;
    display: grid;
    gap: var(--section-gap);
    justify-items: center;
}

.statement {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 700;
    font-size: clamp(40px, 6vw, 96px);
    line-height: 1.08;
    letter-spacing: 0.02em;
    color: var(--graphite);
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.statement-line {
    display: block;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 1.1s var(--ease-monolith), transform 1.1s var(--ease-monolith);
}

.plate--statement.is-in-view .statement-line {
    opacity: 1;
    transform: translateY(0);
}

.plate--statement.is-in-view .statement-line:nth-child(2) {
    transition-delay: 300ms;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -42%);
    font-family: "IBM Plex Mono", monospace;
    font-weight: 700;
    font-size: clamp(220px, 38vw, 560px);
    letter-spacing: 0.02em;
    color: var(--stone);
    opacity: 0.16;
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
    user-select: none;
}

/* ============ COLOPHON ============ */
.plate--colophon .plate-inner {
    text-align: center;
    display: grid;
    gap: clamp(48px, 8vh, 96px);
    justify-items: center;
}

.year-cipher {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 700;
    font-size: clamp(96px, 18vw, 260px);
    letter-spacing: 0.04em;
    color: var(--graphite);
    line-height: 0.94;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    transform-origin: 50% 50%;
    transition: transform 600ms var(--ease-monolith);
    cursor: default;
}

.year-cipher .letter {
    display: inline-block;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 700ms var(--ease-monolith), transform 700ms var(--ease-monolith);
}

.year-cipher.is-engraved .letter {
    opacity: 1;
    transform: scale(1);
}

.signature-block {
    max-width: 600px;
    width: 100%;
}

.signature-line {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--graphite);
    margin: 6px 0;
}

.signature-line--small {
    color: var(--ash);
    font-size: 12px;
}

.terminator {
    margin-top: 16px;
}

.terminator-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--crimson);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(156, 42, 31, 0.08);
}

/* ============ Hover : wordmark / year-cipher (cursor-direction tilt) ============ */
.wordmark.is-hovered,
.year-cipher.is-hovered {
    transform: scale(1.02) rotate(var(--tilt, 0deg));
}

/* ============ Section transition grain shift ============ */
.paper-texture.is-shift {
    transform: translate(8%, -4%);
    transition: transform 800ms var(--ease-monolith), opacity 2s var(--ease-monolith);
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
    :root {
        --outer-margin: 8vw;
        --section-gap: 8vh;
    }

    .folio-frame {
        inset: 16px 16px;
        font-size: 10px;
        letter-spacing: 0.14em;
    }

    .folio-mark--bottom-left,
    .folio-mark--top-right {
        max-width: 48vw;
        text-align: right;
    }

    .wordmark {
        font-size: clamp(56px, 18vw, 120px);
    }

    .statement {
        font-size: clamp(32px, 9vw, 64px);
    }

    .year-cipher {
        font-size: clamp(64px, 22vw, 160px);
    }

    .seal {
        width: 56px;
        height: 56px;
    }

    .seal-mark {
        font-size: 20px;
    }

    .body-block {
        text-align: left;
    }

    .signature-strip {
        font-size: 10.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.001s !important;
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
    }

    .motif-strokes path,
    .motif-strokes circle {
        stroke-dashoffset: 0 !important;
    }
}
