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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #f5f0e8;
    color: #4a1c2b;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    line-height: 1.85;
    letter-spacing: 0.02em;
    /* Dot grid pattern */
    background-image: radial-gradient(circle, #e0d8cc 1px, transparent 1px);
    background-size: 24px 24px;
    padding-bottom: 48px;
}

/* === Typography === */
h1, h2, .section-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: #4a1c2b;
}

.cell-headline {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.cell-body {
    max-width: 58ch;
    margin-bottom: 1rem;
    color: #4a1c2b;
}

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

/* === Underline Draw Links === */
a {
    color: #4a1c2b;
    text-decoration: none;
    background-image: linear-gradient(#b85c3a, #b85c3a);
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding-bottom: 2px;
}

a:hover {
    background-size: 100% 2px;
}

/* === Hero === */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 40vh;
    padding-bottom: 10vh;
}

.hero-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    opacity: 0;
    transition: opacity 600ms ease-out;
    color: #4a1c2b;
}

.hero-title.visible {
    opacity: 1;
}

.hero-leaf {
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.hero-leaf.visible {
    opacity: 1;
}

.ginkgo-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1800ms ease-out;
}

.ginkgo-path.drawn {
    stroke-dashoffset: 0;
}

.hero-spacer {
    height: 80vh;
}

/* === Portfolio Grid === */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 0 clamp(24px, 5vw, 80px);
    max-width: 1200px;
    margin: 0 auto;
}

.grid-cell {
    position: relative;
    padding: 2.5rem;
    background: #f5f0e8;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.grid-cell.in-view {
    opacity: 1;
    transform: translateY(0);
}

.cell-parchment {
    background: #ebe3d5;
}

/* Spanning */
.cell-span-2-1 {
    grid-column: span 2;
}

.cell-span-1-2 {
    grid-row: span 2;
}

@media (max-width: 640px) {
    .cell-span-2-1,
    .cell-span-1-2 {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* === Corner Brackets === */
.cell-brackets::before,
.cell-brackets::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #c9b8a8;
    border-style: solid;
    border-width: 0;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.cell-brackets::before {
    top: 8px;
    left: 8px;
    border-top-width: 1px;
    border-left-width: 1px;
}

.cell-brackets::after {
    bottom: 8px;
    right: 8px;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

.grid-cell.in-view .cell-brackets::before,
.grid-cell.in-view .cell-brackets::after {
    opacity: 1;
}

/* === Leaf Watermarks === */
.leaf-watermark {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0.12;
    pointer-events: none;
}

.leaf-watermark-br {
    top: auto;
    right: auto;
    bottom: 12px;
    left: 12px;
}

/* === Cell Types === */

/* Leaf Cell */
.cell-leaf {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    aspect-ratio: 1 / 1;
}

.cell-leaf .cell-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaf-center {
    opacity: 0.9;
}

/* Quote Cell */
.cell-quote {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    text-align: center;
}

.cell-quote .cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cell-quotation {
    font-family: 'IBM Plex Mono', monospace;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    color: #7a3b4e;
    max-width: 40ch;
    line-height: 1.85;
}

.cell-cite {
    display: block;
    margin-top: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a3b4e;
    font-style: normal;
}

/* Index Cell */
.cell-index {
    min-height: 200px;
}

.cell-index-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2c3a2e;
    margin-bottom: 1.5rem;
}

.cell-index-list {
    list-style: none;
    counter-reset: idx;
}

.cell-index-list li {
    counter-increment: idx;
    margin-bottom: 0.75rem;
}

.cell-index-list li::before {
    content: counter(idx, decimal-leading-zero) ". ";
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: #7a3b4e;
}

.cell-index-list a {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2c3a2e;
}

/* === Section Divider === */
.section-divider {
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}

/* === About Section === */
.about-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem clamp(24px, 5vw, 80px) 6rem;
}

.section-title {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 2rem;
}

.about-text {
    max-width: 58ch;
    margin-bottom: 1.5rem;
    color: #4a1c2b;
}

.about-text em {
    font-style: italic;
    color: #7a3b4e;
}

/* === End Section === */
.end-section {
    text-align: center;
    padding: 4rem 2rem 6rem;
}

.end-text {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #7a3b4e;
    margin-bottom: 2rem;
}

.end-ginkgo {
    opacity: 0.5;
}

/* === Footer Fern === */
.footer-fern {
    padding: 2rem 0 4rem;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.fern-full {
    max-width: 100%;
}

/* === Bottom Navigation === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(245, 240, 232, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.bottom-nav.visible {
    opacity: 1;
}

.nav-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2c3a2e;
    opacity: 0.4;
    transition: opacity 200ms ease;
    padding-bottom: 4px;
}

.nav-label:hover {
    opacity: 0.8;
}

.nav-label.active {
    opacity: 0.8;
    background-image: linear-gradient(#d4a843, #d4a843);
    background-size: 100% 2px;
}
