/* ===================================================
   gur.al -- Design System Stylesheet
   Zen-contemplative, minimalist, sidebar + scroll layout
   Palette: warm parchment, muted sage, charcoal ink
   =================================================== */

/* --- Custom Properties (Palette from DESIGN.md) --- */
:root {
    --color-background: #F7F5F0;
    --color-surface: #EDEAE3;
    --color-text-primary: #2C2925;
    --color-text-secondary: #9B9689;
    --color-accent: #7A8B6E;
    --color-accent-hover: #5C6B50;
    --color-divider: #D6D0C4;
    --color-emphasis: #BF8B60;

    --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-heading: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --sidebar-width: 280px;
    --sidebar-collapsed: 56px;
    --content-max-width: 680px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    letter-spacing: 0.01em;
    overflow-x: hidden;
    /* Subtle dot pattern: #EDEAE3 dots, 48px apart, barely visible texture */
    background-image: radial-gradient(circle, var(--color-surface) 1px, transparent 1px);
    background-size: 48px 48px;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 200ms ease;
}

a:hover {
    color: var(--color-accent-hover);
}

/* --- Typography --- */
p + p {
    margin-top: 1.5em;
}

em, i {
    font-style: italic;
}

strong, b {
    font-weight: 400; /* No bold in body text per design */
}

.section-marker {
    display: block;
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-secondary);
    margin-bottom: 48px;
}

.metadata-caption {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 48px;
}

.opening-line {
    font-size: 1.222rem; /* ~22px */
    line-height: 1.65;
    color: var(--color-text-primary);
}

.closing-line {
    font-style: italic;
    color: var(--color-text-secondary);
    margin-top: 48px;
}

/* --- Sidebar --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--color-background);
    border-right: 1px solid var(--color-divider);
    z-index: 100;
    overflow: hidden;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 64px 32px 32px;
}

.sidebar-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.sidebar-logo svg {
    color: var(--color-text-primary);
    display: block;
}

.sidebar-logotype {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 16px;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--color-text-primary);
}

/* Navigation */
.sidebar-nav {
    margin-top: auto; /* Push nav to bottom third, creating deliberate void above */
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.nav-indicator {
    position: absolute;
    left: -32px;
    top: 0;
    width: 3px;
    height: 24px;
    background-color: var(--color-emphasis);
    border-radius: 0 2px 2px 0;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: color 150ms ease;
    text-decoration: none;
    height: 48px;
}

.nav-link:hover {
    color: var(--color-text-primary);
}

.nav-link.active {
    color: var(--color-text-primary);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-icon svg {
    color: inherit;
}

.nav-text {
    white-space: nowrap;
}

/* Sidebar tagline */
.sidebar-tagline {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-divider);
}

.tagline-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
}

/* --- Mobile Drawer Toggle --- */
.drawer-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--color-divider);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    cursor: pointer;
    z-index: 200;
    align-items: center;
    justify-content: center;
    transition: background-color 200ms ease;
    padding: 0;
}

.drawer-toggle:hover {
    background-color: var(--color-surface);
}

/* --- Main Content --- */
.content {
    margin-left: var(--sidebar-width);
    padding: 40px 48px 120px;
    min-height: 100vh;
}

.section {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding-bottom: 120px;
}

.section:last-of-type {
    padding-bottom: 48px;
}

/* Vertical rhythm: 120px between major sections */
.section + .section {
    padding-top: 72px;
}

/* --- Reveal Blocks (fade-reveal animation) --- */
.reveal-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.reveal-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Icon Clusters --- */
.icon-cluster {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 32px 0;
    margin: 24px 0;
}

.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background-color: var(--color-surface);
    border-radius: 4px;
    transition: background-color 200ms ease;
}

.icon-item:hover {
    background-color: var(--color-divider);
}

.icon-item svg {
    color: var(--color-text-primary);
    transition: color 200ms ease;
}

.icon-item:hover svg {
    color: var(--color-accent);
}

.icon-label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 11px;
    color: var(--color-text-secondary);
    letter-spacing: 0.04em;
    text-transform: lowercase;
}

/* --- Garden Element (footer decoration) --- */
.garden-element {
    max-width: var(--content-max-width);
    margin: 48px auto 0;
    padding: 24px 0;
    text-align: center;
}

.garden-element svg {
    max-width: 100%;
    height: auto;
}

/* ===================================================
   Responsive: Tablet (< 1024px) -- Icon Rail
   Sidebar collapses to 56px icon rail, no text
   =================================================== */
@media (max-width: 1024px) {
    #sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar-inner {
        padding: 64px 0 32px;
        align-items: center;
    }

    .sidebar-identity {
        flex-direction: column;
        gap: 8px;
    }

    .sidebar-logotype {
        display: none;
    }

    .nav-text {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 14px 0;
    }

    .nav-indicator {
        left: 0;
    }

    .sidebar-tagline {
        display: none;
    }

    .content {
        margin-left: var(--sidebar-collapsed);
        padding: 40px 32px 120px;
    }

    .icon-cluster {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================================
   Responsive: Mobile (< 768px) -- Bottom Drawer
   Sidebar becomes bottom-anchored slide-up drawer
   =================================================== */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: auto;
        max-height: 60vh;
        top: auto;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid var(--color-divider);
        transform: translateY(100%);
        transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
        overflow-y: auto;
    }

    #sidebar.open {
        transform: translateY(0);
    }

    .sidebar-inner {
        padding: 32px 24px;
        flex-direction: column;
        align-items: flex-start;
        height: auto;
    }

    .sidebar-logotype {
        display: inline;
    }

    .nav-text {
        display: inline;
    }

    .sidebar-nav {
        margin-top: 24px;
        width: 100%;
    }

    .nav-link {
        height: auto;
        padding: 16px 0;
        border-bottom: 1px solid var(--color-divider);
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-indicator {
        display: none;
    }

    .sidebar-tagline {
        display: block;
        margin-top: 24px;
    }

    .drawer-toggle {
        display: flex;
    }

    .content {
        margin-left: 0;
        padding: 40px 24px 120px;
    }

    .icon-cluster {
        grid-template-columns: repeat(2, 1fr);
    }

    .garden-element svg {
        width: 100%;
    }
}
