@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&family=Inter:wght@400;500&family=Shippori+Mincho:wght@400;600;800&display=swap');

:root {
    /* Color Palette - Calming & Creative */
    --primary-h: 210;
    --primary-s: 100%;
    --primary-l: 60%;
    
    --accent-h: 330;
    --accent-s: 80%;
    --accent-l: 65%;

    --bg-main: hsl(var(--primary-h), 20%, 98%);
    --bg-card: hsla(var(--primary-h), 20%, 100%, 0.7);
    --text-main: hsl(var(--primary-h), 50%, 15%);
    --text-muted: hsl(var(--primary-h), 20%, 45%);
    --border-glass: rgba(255, 255, 255, 0.4);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    
    --radius-lg: 24px;
    --radius-md: 16px;
    
    --font-heading: 'Shippori Mincho', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Accessibility: Skip to Content */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: hsl(var(--primary-h), 80%, 40%);
    color: white;
    padding: 1rem;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Keyboard Focus Visibility */
:focus-visible {
    outline: 3px solid hsl(var(--primary-h), 100%, 50%);
    outline-offset: 4px;
}

body {
    margin: 0;
    padding: 0;
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    background-color: #f7f3e9; /* Washi paper base color */
    overflow-x: hidden;
}

/* Notebook Layout Wrapper */
.notebook-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Tabs */
.sidebar-tabs {
    width: 70px;
    background: hsla(var(--primary-h), 20%, 95%, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.tab-item {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: var(--shadow-soft);
    font-size: 1.2rem;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
}

.tab-item:hover {
    transform: translateX(5px) scale(1.1);
}

.tab-item.active {
    background: var(--text-main);
    color: white;
    transform: translateX(10px);
}

.tab-item::after {
    content: attr(data-label);
    position: absolute;
    left: 60px;
    background: var(--text-main);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.tab-item:hover::after {
    opacity: 1;
}

/* Dynamic Background Container */
#bg-container {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    z-index: -2;
    background-size: cover;
    background-position: center;
    transition: background-image 1.5s ease-in-out, transform 0.1s ease-out;
}

#bg-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.1) 100%),
        rgba(247, 243, 233, 0.4); /* Subtle overexposure / paper wash */
    backdrop-filter: blur(2px);
    z-index: -1;
}

/* Paper Texture Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/natural-paper.png');
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 850px;
    margin: 0 auto 0 70px; /* Offset for sidebar */
    padding: 2.5rem 1.5rem;
    position: relative;
    z-index: 1;
    width: calc(100% - 70px);
}

.page-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.page-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Glassmorphism Card Style - More "Manual" like */
.glass-card {
    background: hsla(45, 30%, 100%, 0.85); /* Creame-tinted glass */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.05); /* Softer shadows */
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, hsl(var(--primary-h), 80%, 40%), hsl(var(--accent-h), 80%, 40%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.hero-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-weight: 500;
}

section h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

section h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 1.5rem;
    background: hsl(var(--primary-h), 80%, 60%);
    border-radius: 2px;
}

/* Grid Layout for Choices */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.exercise-btn {
    appearance: none;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 48px; /* Minimum tap target height */
    min-width: 48px;
}

.exercise-btn:hover {
    transform: translateY(-5px);
    background: white;
    border-color: hsl(var(--primary-h), 80%, 80%);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.exercise-btn.active {
    background: hsl(var(--primary-h), 100%, 95%);
    border-color: hsl(var(--primary-h), 60%, 70%);
    color: hsl(var(--primary-h), 60%, 30%);
}

/* Details Section */
#exercise-detail {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.detail-header {
    margin-bottom: 2rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.meta-item h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.meta-item p {
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

.instruction-list, .reflection-list {
    padding-left: 1.5rem;
}

.instruction-list li, .reflection-list li {
    margin-bottom: 0.75rem;
    position: relative;
}

/* Principles & Triad */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid hsl(var(--primary-h), 70%, 70%);
}

.info-item strong {
    color: hsl(var(--primary-h), 70%, 40%);
    display: block;
    margin-bottom: 0.25rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border-glass);
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.author-card {
    display: inline-block;
    padding: 1.5rem;
    background: hsla(210, 20%, 100%, 0.4);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

/* Attribution UI */
.artwork-attribution {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 100;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.artwork-attribution strong {
    color: var(--text-main);
}

.bg-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s;
}

.bg-switcher:hover {
    transform: rotate(30deg) scale(1.1);
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .sidebar-tabs {
        flex-direction: row;
        width: 100%;
        height: 60px;
        bottom: 0;
        top: auto;
        padding-top: 0;
        justify-content: space-around;
        border-right: none;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    .tab-item {
        margin-bottom: 0;
    }
    .tab-item::after { display: none; }
    .container {
        margin: 0 auto;
        width: 100%;
        padding-bottom: 80px;
    }
    h1 { font-size: 1.8rem; }
}
