/* ==========================================================================
   haskell.monster — A Naturalist's Field Guide to Functional Creatures
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    line-height: 1.9;
    font-size: clamp(15px, 1.1vw, 17px);
    color: #2A2030;
    background-color: #FFF8F0;
    -webkit-font-smoothing: antialiased;
}

code, pre {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-weight: 400;
    font-size: 14px;
}

a {
    color: #4A3A6A;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #C4A040;
}

/* --- Section Dividers --- */
.section-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 40px 0 20px;
}

.section-heading {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 40px);
    text-align: center;
    color: #2A2030;
    letter-spacing: 0.05em;
    margin-bottom: 40px;
    font-variant: small-caps;
}

/* ==========================================================================
   Section 1: Hero — Title Page
   ========================================================================== */

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #FFF8F0;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 40px;
}

.golden-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(196, 160, 64, 0.15) 0%, rgba(196, 160, 64, 0) 70%);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: glowPulse 1.2s 1.4s ease-in-out forwards;
}

@keyframes glowPulse {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.rule-line {
    width: 0;
    height: 1px;
    background-color: #4A3A6A;
    margin: 0 auto;
    animation: drawRule 600ms ease-out forwards;
}

.rule-line-top {
    margin-bottom: 30px;
    animation-delay: 0ms;
}

.rule-line-bottom {
    margin-top: 30px;
    animation-delay: 200ms;
}

@keyframes drawRule {
    0% { width: 0; }
    100% { width: 60%; }
}

.hero-title-block {
    opacity: 0;
    animation: fadeIn 800ms 600ms ease-out forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.hero-subtitle {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(14px, 1.5vw, 20px);
    color: #8A7A90;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.hero-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 120px);
    line-height: 0.95;
    letter-spacing: 0.06em;
    color: #2A2030;
    margin: 0;
}

.hero-edition {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(12px, 1.2vw, 16px);
    color: #8A7A90;
    letter-spacing: 0.04em;
    margin-top: 16px;
    line-height: 1.6;
}

.hero-star-ornament {
    margin-top: 24px;
    transform: scale(0);
    animation: starScale 400ms 1.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes starScale {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Section 2: Bestiary — Monster Card Grid
   ========================================================================== */

.bestiary-section {
    padding: 20px 40px 80px;
    background-color: #FFF8F0;
    max-width: 1200px;
    margin: 0 auto;
}

.monster-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

@media (max-width: 900px) {
    .monster-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .monster-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Monster Card --- */
.monster-card {
    position: relative;
    cursor: default;
}

.card-inner {
    position: relative;
    background-color: #FFF4E8;
    border: 1px solid #4A3A6A;
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card-inner:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(42, 32, 48, 0.12);
}

.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(196, 160, 64, 0) 30%, rgba(196, 160, 64, 0) 100%);
    pointer-events: none;
    z-index: 0;
    transition: background 0.3s ease;
}

.card-inner:hover .card-glow {
    background: radial-gradient(circle, rgba(196, 160, 64, 0.15) 0%, rgba(196, 160, 64, 0) 70%);
}

/* --- Corner Flourishes --- */
.corner-flourish {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 2;
    transition: border-color 0.3s ease;
}

.corner-tl {
    top: 6px;
    left: 6px;
    border-top: 1.5px solid #4A3A6A;
    border-left: 1.5px solid #4A3A6A;
    border-top-left-radius: 4px;
}

.corner-tr {
    top: 6px;
    right: 6px;
    border-top: 1.5px solid #4A3A6A;
    border-right: 1.5px solid #4A3A6A;
    border-top-right-radius: 4px;
}

.corner-bl {
    bottom: 6px;
    left: 6px;
    border-bottom: 1.5px solid #4A3A6A;
    border-left: 1.5px solid #4A3A6A;
    border-bottom-left-radius: 4px;
}

.corner-br {
    bottom: 6px;
    right: 6px;
    border-bottom: 1.5px solid #4A3A6A;
    border-right: 1.5px solid #4A3A6A;
    border-bottom-right-radius: 4px;
}

.card-inner:hover .corner-flourish {
    border-color: #C4A040;
}

/* --- Illustration Area --- */
.illustration-area {
    width: 100%;
    height: 0;
    padding-bottom: 60%;
    position: relative;
    border: 1px dashed #8A7A90;
    border-spacing: 4px;
    margin-bottom: 20px;
    background-color: rgba(255, 248, 240, 0.5);
    overflow: hidden;
}

.creature-outline path,
.creature-outline circle {
    /* Specimen green #4A6A4A for naturalist field illustrations */
}

.illustration-area::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #4A6A4A;
    opacity: 0.4;
}

.creature-outline {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
}

.creature-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 0.8s ease;
}

.card-inner:hover .creature-path {
    stroke-dashoffset: 0;
}

/* --- Card Text --- */
.card-text {
    position: relative;
    z-index: 1;
}

.creature-name {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(18px, 2vw, 24px);
    color: #2A2030;
    margin-bottom: 4px;
}

.creature-classification {
    font-family: 'EB Garamond', Georgia, serif;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    font-size: 13px;
    color: #8A7A90;
    margin-bottom: 12px;
    line-height: 1.4;
}

.field-notes {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    color: #2A2030;
    line-height: 1.7;
}

/* ==========================================================================
   Section 3: Scholarly Reading — Deep Dive
   ========================================================================== */

.reading-section {
    background-color: #FFF8F0;
    padding: 20px 40px 80px;
}

.reading-content {
    max-width: 720px;
    margin: 0 auto;
}

.reading-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(24px, 3.5vw, 42px);
    color: #2A2030;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.2;
}

.reading-subtitle {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(14px, 1.3vw, 18px);
    color: #8A7A90;
    text-align: center;
    margin-bottom: 48px;
}

.reading-body p {
    margin-bottom: 24px;
    text-align: justify;
    hyphens: auto;
}

.reading-body em {
    font-style: italic;
}

.reading-body code {
    background-color: #F0E8E0;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 13px;
    color: #4A3A6A;
}

/* --- Pull Quotes --- */
.pull-quote {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin: 40px 0;
    padding: 24px 0;
    border-top: 1px solid #8A7A90;
    border-bottom: 1px solid #8A7A90;
}

.pull-quote .star-svg {
    flex-shrink: 0;
    margin-top: 6px;
}

.pull-quote blockquote {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(16px, 1.4vw, 20px);
    color: #4A3A6A;
    line-height: 1.7;
    flex: 1;
}

/* --- Code Block --- */
.code-block {
    background-color: #F0E8E0;
    border: 1px solid #8A7A90;
    border-radius: 2px;
    padding: 24px;
    margin: 32px 0;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    background: none;
    padding: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #2A2030;
}

/* --- Footnotes --- */
.footnote-marker {
    font-size: 0.75em;
    vertical-align: super;
    color: #C4A040;
    cursor: help;
    position: relative;
    font-weight: 700;
    transition: color 0.2s ease;
}

.footnote-marker::before {
    content: attr(data-footnote);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 12px 16px;
    background-color: #FFF4E8;
    border: 1px solid #4A3A6A;
    font-size: 13px;
    font-weight: 400;
    font-style: italic;
    line-height: 1.6;
    color: #2A2030;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(42, 32, 48, 0.1);
    vertical-align: baseline;
}

.footnote-marker:hover::before {
    opacity: 1;
}

.footnote-marker:hover {
    color: #4A3A6A;
}

/* ==========================================================================
   Section 4: Sightings Log — Timeline
   ========================================================================== */

.sightings-section {
    background-color: #FFF8F0;
    padding: 20px 40px 80px;
    max-width: 900px;
    margin: 0 auto;
}

.sightings-intro {
    text-align: center;
    font-style: italic;
    color: #8A7A90;
    margin-bottom: 48px;
    font-size: clamp(14px, 1.2vw, 17px);
}

.timeline {
    position: relative;
    padding-left: 120px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 100px;
    width: 1px;
    height: 100%;
    background-color: #4A3A6A;
}

.timeline-entry {
    position: relative;
    margin-bottom: 36px;
    padding: 20px 24px;
    background-color: #FFF4E8;
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 28px;
    width: 8px;
    height: 8px;
    background-color: #C4A040;
    border: 1.5px solid #4A3A6A;
    border-radius: 50%;
}

.timeline-entry:hover {
    transform: translateY(-3px);
    border-color: #4A3A6A;
    box-shadow: 0 8px 24px rgba(42, 32, 48, 0.08);
}

.entry-date {
    position: absolute;
    left: -116px;
    top: 20px;
    font-family: 'EB Garamond', Georgia, serif;
    font-variant: small-caps;
    font-weight: 700;
    font-size: 16px;
    color: #4A3A6A;
    letter-spacing: 0.1em;
    width: 80px;
    text-align: right;
}

.entry-content {
    position: relative;
}

.entry-version {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    font-size: 13px;
    color: #8A7A90;
    margin-bottom: 2px;
}

.entry-creature {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(17px, 1.5vw, 22px);
    color: #2A2030;
    margin-bottom: 8px;
}

.entry-description {
    font-size: clamp(14px, 1vw, 16px);
    color: #2A2030;
    line-height: 1.7;
}

.entry-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #8A7A90;
    font-size: 14px;
    font-style: italic;
    color: #8A7A90;
    line-height: 1.7;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.4s ease;
}

.timeline-entry:hover .entry-details {
    opacity: 1;
    max-height: 200px;
}

/* ==========================================================================
   Footer — Field Guide Footer
   ========================================================================== */

.footer-section {
    padding: 0 40px 40px;
    background-color: #FFF8F0;
}

.footer-border {
    width: 60%;
    height: 1px;
    background-color: #4A3A6A;
    margin: 0 auto 32px;
}

.footer-content {
    text-align: center;
}

.footer-classification {
    font-family: 'EB Garamond', Georgia, serif;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    font-size: 14px;
    color: #8A7A90;
    margin-bottom: 16px;
}

.footer-links {
    margin-bottom: 20px;
}

.footer-link {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 15px;
    color: #4A3A6A;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #C4A040;
}

.footer-separator {
    color: #8A7A90;
    margin: 0 12px;
}

.footer-note {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 13px;
    color: #8A7A90;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .bestiary-section {
        padding: 20px 20px 60px;
    }

    .reading-section {
        padding: 20px 20px 60px;
    }

    .sightings-section {
        padding: 20px 20px 60px;
    }

    .timeline {
        padding-left: 0;
    }

    .timeline::before {
        display: none;
    }

    .timeline-entry::before {
        display: none;
    }

    .entry-date {
        position: static;
        width: auto;
        text-align: left;
        margin-bottom: 4px;
    }

    .pull-quote {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footnote-marker::before {
        left: 0;
        transform: none;
        width: 220px;
    }

    .hero-content {
        padding: 20px;
    }

    .footer-section {
        padding: 0 20px 30px;
    }
}
