/* gamelicensor.pro - Wabi-sabi x Art Deco Licensing Codex */

/* ===== @property for border-animate ===== */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #3d3528;
    background-color: #f0e6d0;
    transition: background-color 1.2s ease-out;
    overflow-x: hidden;
}

/* ===== Navigation ===== */
.codex-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    padding: 1.2rem 2rem;
    background: linear-gradient(180deg, rgba(240, 230, 208, 0.95) 0%, rgba(240, 230, 208, 0) 100%);
    transition: background 1.2s ease-out;
}

body.dark-folio .codex-nav {
    background: linear-gradient(180deg, rgba(28, 24, 16, 0.95) 0%, rgba(28, 24, 16, 0) 100%);
}

.nav-link {
    font-family: 'Poiret One', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5c4a2e;
    text-decoration: none;
    position: relative;
    padding-bottom: 4px;
    transition: color 1.2s ease-out;
}

body.dark-folio .nav-link {
    color: #b8a88e;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: #c9a84c;
    transition: width 0.6s ease-out, left 0.6s ease-out;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* ===== Folio Base ===== */
.folio {
    position: relative;
    min-height: 100vh;
    padding: 5vw;
    overflow: hidden;
}

.folio-vignette {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 200px rgba(28, 24, 16, 0.3);
    pointer-events: none;
    z-index: 2;
}

.folio-grain {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #5c4a2e 0.5px, transparent 0.5px);
    background-size: 3px 3px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1;
}

.folio-content {
    position: relative;
    z-index: 3;
    min-height: calc(100vh - 10vw);
    display: flex;
    align-items: center;
}

/* ===== Typography ===== */
.folio-title {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c9a84c;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.folio-title-light {
    color: #c9a84c;
}

.folio-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.04em;
    line-height: 1.35;
    color: #5c4a2e;
    margin-bottom: 2.5rem;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    max-width: 62ch;
    color: #3d3528;
    margin-bottom: 1.5rem;
}

.body-text-light {
    color: #f0e6d0;
}

.annotation-code {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    line-height: 1.6;
    color: #7a6e5d;
}

.annotation-code-light {
    color: #b8a88e;
}

.annotation-text {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    line-height: 1.6;
    color: #5c4a2e;
    margin-top: 0.75rem;
}

/* ===== Folio I - The Seal ===== */
.folio-i {
    background-color: #f0e6d0;
}

.folio-i-layout {
    justify-content: space-between;
    padding-left: 80px;
    padding-right: 48px;
}

.seal-container {
    flex-shrink: 0;
}

.hero-seal {
    width: clamp(200px, 30vw, 300px);
    height: auto;
    animation: seal-rotate 120s linear infinite;
}

.hero-seal:hover {
    animation-play-state: paused;
}

@keyframes seal-rotate {
    to { transform: rotate(360deg); }
}

.seal-text {
    font-family: 'Poiret One', sans-serif;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-right {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.pressed-leaf-hero {
    width: clamp(80px, 12vw, 120px);
    height: auto;
    filter: sepia(0.15) contrast(1.05);
}

/* Chevron Friezes */
.chevron-frieze {
    display: flex;
    justify-content: center;
    gap: 2px;
    position: absolute;
    left: 5vw;
    right: 5vw;
}

.frieze-top {
    top: 5vw;
}

.frieze-bottom {
    bottom: 2rem;
}

.chevron {
    width: 12px;
    height: 8px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.chevron-frieze.animated .chevron {
    opacity: 1;
    transform: scale(1);
}

/* ===== Folio II - The Registry ===== */
.folio-ii {
    background-color: #e8dcc4;
}

.folio-ii-layout {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    padding-left: 80px;
    padding-right: 48px;
}

.registry-main {
    flex: 0 0 61.8%;
}

.registry-aside {
    flex: 0 0 calc(38.2% - 4rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-top: 4rem;
}

.annotation-box {
    padding: 1.5rem;
    position: relative;
    border-radius: 2px;
    background: rgba(240, 230, 208, 0.5);
}

/* Border animate */
.border-animate {
    position: relative;
}

.border-animate::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: 2px;
    background: linear-gradient(var(--angle, 0deg), #a67c32, #c9a84c, #d4b86a, #c9a84c, #a67c32) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    animation: border-rotate 8s ease-in-out infinite;
    pointer-events: none;
}

.border-animate:hover::before {
    border-width: 3px;
    animation-duration: 4s;
}

@keyframes border-rotate {
    to { --angle: 360deg; }
}

/* Marginalia leaf */
.marginalia-leaf {
    position: absolute;
    z-index: 4;
}

.marginalia-leaf-1 {
    width: 40px;
    top: 15%;
    right: 3vw;
    transform: rotate(15deg);
}

/* ===== Folio III - The Garden ===== */
.folio-iii {
    background-color: #d4ccb4;
}

.folio-iii-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 100vh;
}

.garden-leaf {
    position: absolute;
    z-index: 3;
    filter: sepia(0.15) contrast(1.05);
}

.garden-leaf-1 {
    width: clamp(100px, 18vw, 180px);
    top: 8%;
    left: 10%;
    transform: rotate(-15deg);
}

.garden-leaf-2 {
    width: clamp(80px, 14vw, 140px);
    top: 15%;
    right: 15%;
    transform: rotate(25deg);
}

.garden-leaf-3 {
    width: clamp(120px, 20vw, 200px);
    bottom: 15%;
    left: 25%;
    transform: rotate(-8deg);
}

.garden-leaf-4 {
    width: clamp(70px, 12vw, 110px);
    bottom: 20%;
    right: 20%;
    transform: rotate(35deg);
}

/* Leaf vein draw animation */
.leaf-vein-draw {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2.5s ease-out;
}

.garden-leaf.animate .leaf-vein-draw {
    stroke-dashoffset: 0;
}

.leaf-fill {
    transition: opacity 0.8s ease-out 2.5s;
}

.garden-leaf.animate .leaf-fill {
    opacity: 0.85;
}

.garden-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3.5vw, 3rem);
    color: #5c4a2e;
    text-align: center;
    max-width: 50ch;
    line-height: 1.4;
    position: relative;
    z-index: 5;
    padding: 0 2rem;
}

.skeleton-leaf-watermark {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.vine-diagonal {
    position: absolute;
    right: 8vw;
    top: 0;
    height: 100%;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}

/* ===== Folio IV - The Specifications ===== */
.folio-iv {
    background-color: #3d3528;
}

.folio-iv-layout {
    flex-direction: column;
    gap: 6rem;
    padding-left: 80px;
    padding-right: 48px;
    position: relative;
}

.spec-block {
    padding: 2.5rem;
    border-radius: 2px;
    max-width: 55ch;
    position: relative;
    border-left: 4px solid transparent;
    transition: border-color 1s ease-out;
}

.spec-block.visible {
    border-left-color: #c9a84c;
}

.folio-iv .border-animate {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
}

.spec-block-1 {
    align-self: flex-start;
}

.spec-block-2 {
    align-self: center;
}

.spec-block-3 {
    align-self: flex-end;
}

.z-hairline {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

/* ===== Folio V - The Colophon ===== */
.folio-v {
    background-color: #1c1810;
}

.folio-v-layout {
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    min-height: calc(100vh - 10vw);
    padding-left: 80px;
    padding-right: 48px;
    position: relative;
}

.colophon-vine {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.colophon-text {
    position: relative;
    z-index: 3;
    max-width: 55ch;
    padding-top: 4rem;
}

.colophon-title {
    margin-bottom: 2rem;
}

.colophon-body {
    margin-bottom: 2rem;
}

.colophon-date {
    display: block;
    margin-top: 1rem;
}

.colophon-seal-container {
    align-self: flex-end;
    position: relative;
    z-index: 3;
    padding-bottom: 2rem;
}

.colophon-seal {
    width: clamp(180px, 25vw, 280px);
    height: auto;
    animation: seal-rotate 120s linear infinite;
    filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.2));
}

.colophon-seal:hover {
    animation-play-state: paused;
}

/* Corner flourishes */
.corner-flourish {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 4;
    pointer-events: none;
}

.corner-tl {
    top: 5vw;
    left: 5vw;
}

.corner-br {
    bottom: 5vw;
    right: 5vw;
}

/* ===== Dark folio transitions ===== */
body.dark-folio {
    color: #f0e6d0;
}

body.dark-folio .folio-subtitle {
    color: #b8a88e;
}

/* ===== Entrance Animations ===== */
.folio-title,
.folio-subtitle,
.body-text,
.annotation-box,
.spec-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out, border-color 1s ease-out;
}

.folio-title.visible,
.folio-subtitle.visible,
.body-text.visible,
.annotation-box.visible,
.spec-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .folio-i-layout {
        flex-direction: column;
        align-items: center;
        padding-left: 5vw;
        padding-right: 5vw;
        gap: 3rem;
    }

    .folio-ii-layout {
        flex-direction: column;
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .registry-main,
    .registry-aside {
        flex: 1 1 100%;
    }

    .registry-aside {
        padding-top: 2rem;
    }

    .folio-iv-layout {
        padding-left: 5vw;
        padding-right: 5vw;
        gap: 4rem;
    }

    .spec-block-1,
    .spec-block-2,
    .spec-block-3 {
        align-self: stretch;
        max-width: 100%;
    }

    .folio-v-layout {
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .codex-nav {
        gap: 1rem;
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.7rem;
    }
}

@media (max-width: 600px) {
    .codex-nav {
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.6rem;
        letter-spacing: 0.08em;
    }
}

/* ===== Garden & Organic Colors ===== */
.garden-leaf {
    --leaf-green: #6b7f4a;
    --leaf-shadow: #3d4a2e;
}

.vine-diagonal path,
.colophon-vine .vine-path {
    stroke: #6b7f4a;
}

.folio-iii .folio-grain {
    background-image: radial-gradient(circle, #3d4a2e 0.5px, transparent 0.5px);
}
