/* ============================================
   GGOGGL.com - Inventor's Notebook Design System
   Ethereal Blue Skeuomorphic + Hand-drawn Hybrid
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Palette */
    --bg-linen: #e8eef4;
    --worksurface: #f0f4f8;
    --primary-text: #1b2a4a;
    --secondary-text: #5b6fa3;
    --accent: #4a90d9;
    --accent-hover: #3178c6;
    --highlight: #a8c8f0;
    --tab-active: #d4b896;
    --shadow-depth: #0f1729;
    --code-bg: #1a1a2e;
    --code-text: #a8d8ea;
    --brushed-silver: #b8c4d0;
    --muted-rose: #c97b84;
    --leather-light: #c9a96e;
    --leather-dark: #b8935a;
    --metal-light: #c8d4e0;
    --metal-mid: #a0b0c4;
    --metal-border: #8a9ab0;
    --grid-stroke: #d0d8e4;
    --muted-navy: #2c3e6b;

    /* Typography */
    --font-heading: 'Caveat', cursive;
    --font-body: 'Nunito', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Timing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--bg-linen);
    color: var(--primary-text);
}

body {
    position: relative;
    opacity: 0;
    animation: fadeInBody 300ms ease forwards;
}

@keyframes fadeInBody {
    to { opacity: 1; }
}

/* --- Graph Paper Background --- */
#graph-paper-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* --- Ink Splatters --- */
#ink-splatters {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.splatter {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--highlight) 0%, transparent 70%);
    opacity: 0.04;
}

/* --- Logo Medallion --- */
#logo-medallion {
    position: fixed;
    top: 12px;
    left: 8px;
    z-index: 100;
    width: 44px;
    height: 44px;
}

.medallion-outer {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--metal-light), var(--metal-mid));
    border: 1px solid var(--metal-border);
    box-shadow: 0 2px 4px rgba(15, 23, 41, 0.2), inset 0 1px 0 rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.medallion-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--worksurface);
    box-shadow: inset 0 1px 3px rgba(15, 23, 41, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.magnifying-glass-logo {
    width: 28px;
    height: 28px;
}

/* --- Drawer Tab Navigation --- */
#drawer-tabs {
    position: fixed;
    top: 0;
    left: 0;
    width: 60px;
    height: 100vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 70px;
}

.tab-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.drawer-tab {
    display: flex;
    align-items: center;
    width: 56px;
    height: 48px;
    padding: 0 4px 0 6px;
    border: none;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(135deg, var(--leather-light), var(--leather-dark));
    cursor: pointer;
    position: relative;
    box-shadow: 2px 2px 4px rgba(15, 23, 41, 0.2), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 250ms var(--ease-spring);
    opacity: 0;
    transform: translateX(-60px);
    animation: slideInTab 300ms var(--ease-spring) forwards;
    overflow: hidden;
}

.drawer-tab:nth-child(1) { animation-delay: 600ms; }
.drawer-tab:nth-child(2) { animation-delay: 650ms; }
.drawer-tab:nth-child(3) { animation-delay: 700ms; }
.drawer-tab:nth-child(4) { animation-delay: 750ms; }
.drawer-tab:nth-child(5) { animation-delay: 800ms; }

@keyframes slideInTab {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.drawer-tab:hover {
    width: 62px;
    background: linear-gradient(135deg, #d4b87a, var(--leather-dark));
    box-shadow: 3px 2px 6px rgba(15, 23, 41, 0.25), inset 0 1px 0 rgba(255,255,255,0.3);
}

.drawer-tab.active {
    background: linear-gradient(135deg, var(--tab-active), #c4a47a);
    width: 64px;
    box-shadow: 3px 2px 8px rgba(15, 23, 41, 0.3), inset 0 1px 0 rgba(255,255,255,0.35);
}

.tab-stitch {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-right: 2px dashed rgba(255, 255, 255, 0.25);
}

.tab-label {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-text);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-left: 4px;
}

.crafted-stamp {
    margin-top: auto;
    padding: 12px 4px 16px;
    text-align: center;
    width: 60px;
}

.stamp-text {
    font-family: var(--font-heading);
    font-size: 9px;
    color: var(--secondary-text);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    opacity: 0.6;
}

/* --- Worksurface --- */
#worksurface {
    position: fixed;
    top: 16px;
    left: 68px;
    right: 16px;
    bottom: 16px;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    animation: slideUpWorksurface 400ms ease-out 300ms forwards;
}

@keyframes slideUpWorksurface {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bezel-frame {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--metal-light), var(--metal-mid));
    border: 1px solid var(--metal-border);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 4px 16px rgba(15, 23, 41, 0.15), inset 0 1px 0 rgba(255,255,255,0.4);
    position: relative;
}

/* --- Rivets --- */
.rivet {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #d8e0ea, var(--metal-mid) 60%, var(--metal-border));
    box-shadow: 0 1px 2px rgba(15, 23, 41, 0.3), inset 0 1px 1px rgba(255,255,255,0.5);
    z-index: 5;
}

.rivet-tl { top: 8px; left: 8px; }
.rivet-tr { top: 8px; right: 8px; }
.rivet-bl { bottom: 8px; left: 8px; }
.rivet-br { bottom: 8px; right: 8px; }

/* --- Content Viewport --- */
#content-viewport {
    width: 100%;
    height: 100%;
    background: var(--worksurface);
    border-radius: 4px;
    box-shadow: inset 0 2px 6px rgba(15, 23, 41, 0.15), inset 0 -1px 0 rgba(255,255,255,0.5);
    overflow: hidden;
    position: relative;
}

/* --- Content Panels --- */
.content-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 250ms var(--ease-smooth), transform 250ms var(--ease-smooth);
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: var(--highlight) transparent;
}

.content-panel::-webkit-scrollbar {
    width: 6px;
}

.content-panel::-webkit-scrollbar-track {
    background: transparent;
}

.content-panel::-webkit-scrollbar-thumb {
    background: var(--highlight);
    border-radius: 3px;
}

.content-panel.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    z-index: 1;
}

.content-panel.exiting {
    opacity: 0;
    transform: translateX(-40px);
}

.panel-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px;
}

/* --- Typography --- */
.section-title {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-text);
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    line-height: 1.1;
}

.subsection-title {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 600;
    color: var(--primary-text);
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    margin-top: 32px;
}

.body-text {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 28px;
    color: var(--muted-navy);
    margin-bottom: 24px;
}

/* --- Hand-drawn Dividers --- */
.hand-drawn-divider {
    width: 100%;
    height: 20px;
    margin-bottom: 24px;
    display: block;
}

.wave-divider {
    width: 100%;
    height: 40px;
    margin: 32px 0;
    display: block;
}

.wave-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.5s ease;
}

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

/* --- Feature List --- */
.feature-list {
    margin: 32px 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(168, 200, 240, 0.08);
    border-radius: 6px;
    box-shadow: 0 2px 0 var(--shadow-depth), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 150ms var(--ease-spring);
}

.feature-item:hover {
    transform: translateY(-1px);
}

.gear-bullet {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.gear-bullet svg {
    width: 24px;
    height: 24px;
}

.feature-text {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--muted-navy);
}

/* --- Toggle Switch --- */
.toggle-switch-demo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.toggle-label {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--secondary-text);
}

.toggle-switch {
    cursor: pointer;
    display: inline-block;
}

.toggle-track {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #a0aab8, #8a94a4);
    border: 1px solid var(--metal-border);
    box-shadow: inset 0 2px 4px rgba(15, 23, 41, 0.2), 0 1px 0 rgba(255,255,255,0.3);
    position: relative;
    transition: background 150ms var(--ease-spring);
}

.toggle-track.on {
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff, #e0e4ea);
    box-shadow: 0 2px 4px rgba(15, 23, 41, 0.3), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: transform 150ms var(--ease-spring);
}

.toggle-track.on .toggle-thumb {
    transform: translateX(24px);
}

/* --- Notebook Note --- */
.notebook-note {
    position: relative;
    background: linear-gradient(135deg, #fdf8f0, #f5eed8);
    border: 1px solid #e0d4b8;
    border-radius: 2px;
    padding: 24px 24px 24px 32px;
    margin: 32px 0;
    box-shadow: 2px 3px 8px rgba(15, 23, 41, 0.1);
    transform: rotate(-0.5deg);
}

.note-pin {
    position: absolute;
    top: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #e8505b, #c03040);
    box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

.note-text {
    font-family: var(--font-heading);
    font-size: 16px;
    line-height: 24px;
    color: #5a4a30;
}

/* --- Magnifying Glass Hero --- */
.magnifying-glass-hero {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
    opacity: 0;
    transform: scale(0.95);
    animation: scaleInHero 500ms ease-out 700ms forwards;
}

@keyframes scaleInHero {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hero-goggle {
    width: 200px;
    height: 200px;
    animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 0px var(--highlight));
    }
    50% {
        filter: drop-shadow(0 0 12px var(--highlight));
    }
}

.hero-goggle:hover {
    animation: none;
    filter: drop-shadow(0 0 16px var(--accent));
}

/* --- Workshop Cards --- */
.workshop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 32px 0;
}

.workshop-card {
    border-radius: 6px;
}

.card-bezel {
    background: linear-gradient(180deg, var(--metal-light), var(--metal-mid));
    border: 1px solid var(--metal-border);
    border-radius: 6px;
    padding: 24px;
    position: relative;
    box-shadow: 0 3px 8px rgba(15, 23, 41, 0.12), inset 0 1px 0 rgba(255,255,255,0.4);
}

.card-rivet {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #d8e0ea, var(--metal-mid) 60%, var(--metal-border));
    box-shadow: 0 1px 2px rgba(15, 23, 41, 0.25), inset 0 1px 1px rgba(255,255,255,0.4);
}

.card-rivet-tl { top: 8px; left: 8px; }
.card-rivet-tr { top: 8px; right: 8px; }

.card-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 8px;
}

.card-desc {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 24px;
    color: var(--muted-navy);
    margin-bottom: 16px;
}

.circuit-trace {
    width: 100%;
    max-width: 200px;
    height: 60px;
}

/* --- Measurement Bar --- */
.measurement-bar {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: var(--worksurface);
    box-shadow: inset 0 2px 4px rgba(15, 23, 41, 0.15);
    position: relative;
    overflow: hidden;
}

.measure-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--accent), var(--highlight));
    transition: width 1s ease-out;
}

.measure-label {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--primary-text);
}

/* --- Schematic Diagram --- */
.schematic-diagram {
    margin: 32px 0;
    padding: 24px;
    background: var(--worksurface);
    border: 1px solid var(--grid-stroke);
    border-radius: 4px;
    box-shadow: inset 0 2px 6px rgba(15, 23, 41, 0.08);
}

.full-schematic {
    width: 100%;
    max-width: 500px;
    display: block;
    margin: 0 auto;
}

/* --- Annotation Callout --- */
.annotation-callout {
    position: relative;
    padding: 16px 20px;
    background: rgba(168, 200, 240, 0.12);
    border-left: 3px solid var(--accent);
    border-radius: 0 4px 4px 0;
    margin: 24px 0;
}

.callout-arrow {
    position: absolute;
    left: -8px;
    top: 16px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid var(--accent);
}

.callout-text {
    font-family: var(--font-heading);
    font-size: 15px;
    line-height: 22px;
    color: var(--secondary-text);
}

/* --- Depth Model --- */
.depth-layers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.depth-layer {
    padding: 16px 24px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--primary-text);
    transition: transform 200ms var(--ease-spring);
}

.depth-layer:hover {
    transform: translateY(-2px);
}

.layer-shadow {
    background: var(--shadow-depth);
    color: var(--code-text);
    box-shadow: 0 4px 12px rgba(15, 23, 41, 0.4);
}

.layer-base {
    background: var(--worksurface);
    border: 1px solid var(--grid-stroke);
    box-shadow: 0 2px 4px rgba(15, 23, 41, 0.15);
}

.layer-raised {
    background: linear-gradient(180deg, var(--metal-light), var(--metal-mid));
    border: 1px solid var(--metal-border);
    box-shadow: 0 2px 0 var(--shadow-depth), inset 0 1px 0 rgba(255,255,255,0.3);
}

.layer-highlight {
    background: linear-gradient(180deg, #fff, var(--worksurface));
    border: 1px solid var(--highlight);
    box-shadow: 0 0 8px rgba(168, 200, 240, 0.4), inset 0 1px 0 rgba(255,255,255,0.8);
}

/* --- Terminal Window --- */
.terminal-window {
    border-radius: 8px;
    overflow: hidden;
    margin: 24px 0;
    box-shadow: 0 4px 16px rgba(15, 23, 41, 0.25);
}

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #2a2a3e, #1e1e30);
    border-bottom: 1px solid rgba(168, 200, 240, 0.1);
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-ridge {
    flex: 1;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        rgba(168, 200, 240, 0.08) 0px,
        rgba(168, 200, 240, 0.08) 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 2px;
}

.terminal-filename {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--code-text);
    opacity: 0.7;
}

.terminal-body {
    background: var(--code-bg);
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 24px;
}

.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
}

.term-prompt {
    color: #27c93f;
    font-weight: 500;
}

.term-cmd {
    color: var(--code-text);
}

.term-output {
    color: #8892a4;
}

.term-success {
    color: #27c93f;
}

.term-comment {
    color: #5b6580;
}

.term-key {
    color: var(--accent);
}

.term-value {
    color: var(--tab-active);
}

.term-cursor {
    color: var(--code-text);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Goggle Viewport (About) --- */
.about-intro {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.goggle-viewport {
    position: relative;
}

.goggle-lens {
    width: 160px;
    height: 160px;
    animation: pulseGlow 2.5s ease-in-out infinite;
}

.goggle-lens:hover {
    animation: none;
    filter: drop-shadow(0 0 16px var(--accent));
}

/* --- Principles List --- */
.principles-list {
    margin: 24px 0;
}

.principle-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--grid-stroke);
}

.principle-item:last-child {
    border-bottom: none;
}

.principle-number {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 144, 217, 0.1);
    border-radius: 50%;
}

.principle-content {
    flex: 1;
}

.principle-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 4px;
}

.principle-desc {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 24px;
    color: var(--secondary-text);
}

/* --- Reveal on Scroll Animation --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Cursor Goggle Follower --- */
#cursor-goggle {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transition: opacity 200ms ease, transform 200ms ease;
    transform: translate(-50%, -50%);
}

#cursor-goggle.visible {
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #drawer-tabs {
        width: 44px;
    }

    .drawer-tab {
        width: 40px;
        height: 40px;
    }

    .drawer-tab:hover {
        width: 46px;
    }

    .drawer-tab.active {
        width: 48px;
    }

    .tab-label {
        font-size: 9px;
    }

    #worksurface {
        left: 52px;
        top: 10px;
        right: 10px;
        bottom: 10px;
    }

    .panel-inner {
        padding: 32px 24px;
    }

    .section-title {
        font-size: 36px;
    }

    .subsection-title {
        font-size: 28px;
    }

    #logo-medallion {
        width: 36px;
        height: 36px;
        top: 8px;
        left: 4px;
    }

    .medallion-outer {
        width: 36px;
        height: 36px;
    }

    .medallion-inner {
        width: 28px;
        height: 28px;
    }

    .magnifying-glass-logo {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .panel-inner {
        padding: 24px 16px;
    }

    .section-title {
        font-size: 30px;
    }

    .body-text {
        font-size: 15px;
        line-height: 24px;
    }

    .hero-goggle {
        width: 150px;
        height: 150px;
    }
}