/* ============================================================
   amamya.dev — quiet observatory
   inflated-3d + aurora-gradient + watercolor + circuit + calm-serene
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

:root {
    --indigo: #0E1430;
    --glacial: #3B5BB5;
    --lilac: #8E7BC8;
    --mint: #5FD3B8;
    --vellum: #F4ECDF;

    --inset-light: inset 2px 2px 4px rgba(244, 236, 223, 0.18);
    --inset-shadow: inset -2px -2px 6px rgba(14, 20, 48, 0.5);
    --outer-drop: 0 12px 32px rgba(14, 20, 48, 0.4);

    --settle: cubic-bezier(0.22, 0.61, 0.36, 1);
    --baseline: 8px;
    --section-gap: 64px;
}

body {
    background: var(--indigo);
    color: var(--vellum);
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: 0;
    overflow-x: hidden;
    cursor: none;
    min-height: 100vh;
    position: relative;
}

/* Grain overlay — barely visible 2% opacity to prevent banding */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.02;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
}

/* Custom cursor — small inflated indigo bead with mint trace */
.cursor-bead {
    position: fixed;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--lilac), var(--glacial) 60%, var(--indigo));
    box-shadow:
        var(--inset-light),
        var(--inset-shadow),
        0 0 12px rgba(95, 211, 184, 0.3);
    pointer-events: none;
    z-index: 2000;
    transform: translate(-50%, -50%);
    transition: transform 600ms var(--settle);
    will-change: transform, left, top;
}

.cursor-trace {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mint);
    opacity: 0.5;
    pointer-events: none;
    z-index: 1999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(95, 211, 184, 0.5);
    will-change: transform, left, top;
}

/* ============================================================
   Navigation pill — upper-left, labels reveal on proximity hover
   ============================================================ */
.nav-pill {
    position: fixed;
    top: 36px;
    left: 36px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(59, 91, 181, 0.6), rgba(14, 20, 48, 0.85));
    box-shadow:
        var(--inset-light),
        var(--inset-shadow),
        var(--outer-drop);
    transition: padding 800ms var(--settle), gap 800ms var(--settle);
}

.nav-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--vellum), var(--lilac) 70%);
    box-shadow:
        inset 1px 1px 2px rgba(244, 236, 223, 0.4),
        inset -1px -1px 2px rgba(14, 20, 48, 0.6),
        0 2px 6px rgba(14, 20, 48, 0.4);
    cursor: pointer;
    transition: transform 600ms var(--settle), box-shadow 600ms var(--settle);
}

.nav-dot:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 1px 1px 2px rgba(244, 236, 223, 0.5),
        inset -1px -1px 2px rgba(14, 20, 48, 0.7),
        0 6px 16px rgba(14, 20, 48, 0.55);
}

.nav-labels {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 800ms var(--settle), opacity 800ms var(--settle), margin-left 800ms var(--settle);
}

.nav-pill.open .nav-labels {
    max-width: 360px;
    opacity: 1;
    margin-left: 6px;
}

.nav-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--vellum);
    text-transform: lowercase;
    white-space: nowrap;
}

/* ============================================================
   Section: Masthead
   ============================================================ */
.masthead {
    position: relative;
    min-height: 100vh;
    padding: 96px;
    padding-top: 25vh;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

/* Aurora wash — diagonal sweep from glacial → lilac → mint */
.aurora-wash {
    position: absolute;
    inset: -10%;
    pointer-events: none;
    background:
        linear-gradient(
            120deg,
            rgba(59, 91, 181, 0.18) 0%,
            rgba(142, 123, 200, 0.20) 35%,
            rgba(95, 211, 184, 0.15) 65%,
            transparent 90%
        );
    background-size: 220% 220%;
    background-position: 0% 0%;
    filter: blur(40px);
    animation: aurora-drift 60s linear infinite;
    z-index: 0;
}

@keyframes aurora-drift {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* Watercolor washes */
.watercolor {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    animation: watercolor-drift 90s ease-in-out infinite;
    will-change: transform;
}

.watercolor-masthead {
    top: 0;
    right: 0;
    width: 70%;
    height: 90%;
    opacity: 0.85;
}

.watercolor-works {
    top: 5%;
    right: -10%;
    width: 60%;
    height: 100%;
    opacity: 0.7;
}

@keyframes watercolor-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-20px, 14px) scale(1.04); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Circuit traces */
.circuit {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.circuit-masthead {
    bottom: 5%;
    left: 4%;
    width: 50%;
    height: 60%;
    opacity: 0.7;
}

.circuit-works {
    top: 0;
    left: 2%;
    width: 30%;
    height: 100%;
    opacity: 0.55;
}

.circuit-footer {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

.circuit-trace {
    fill: none;
    stroke: var(--mint);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.solder-pad {
    fill: var(--mint);
    filter: drop-shadow(0 0 4px rgba(95, 211, 184, 0.6));
    animation: solder-pulse 4s ease-in-out infinite;
}

@keyframes solder-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); transform-origin: center; }
    50%      { opacity: 1; }
}

/* Masthead inner content */
.masthead-inner {
    position: relative;
    z-index: 5;
    max-width: 58%;
}

.wordmark {
    font-family: 'Outfit', sans-serif;
    font-size: 96px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--vellum);
    margin-bottom: 32px;
    display: inline-block;
}

.wordmark-letter, .wordmark-dot {
    display: inline-block;
    color: var(--vellum);
    text-shadow:
        2px 2px 0 rgba(14, 20, 48, 0.4),
        -1px -1px 0 rgba(244, 236, 223, 0.15),
        0 8px 20px rgba(14, 20, 48, 0.6);
    transition: transform 800ms var(--settle), text-shadow 800ms var(--settle);
}

.wordmark-letter:hover {
    transform: translateY(-3px);
}

.wordmark-dot {
    color: var(--mint);
    text-shadow:
        0 0 14px rgba(95, 211, 184, 0.6),
        2px 2px 0 rgba(14, 20, 48, 0.4);
}

.masthead-line {
    font-size: 21px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--vellum);
    opacity: 0.86;
    max-width: 540px;
}

.masthead-mark {
    display: block;
    width: 80px;
    height: 8px;
    margin-top: 48px;
    background: linear-gradient(90deg, var(--lilac), var(--mint));
    border-radius: 8px;
    opacity: 0.55;
    box-shadow: 0 4px 14px rgba(95, 211, 184, 0.3);
}

/* End-of-section dot punctuation */
.dot-end {
    position: absolute;
    bottom: 24px;
    left: 96px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--vellum), var(--lilac) 60%);
    box-shadow:
        inset 1px 1px 2px rgba(244, 236, 223, 0.4),
        inset -1px -1px 1px rgba(14, 20, 48, 0.5),
        0 2px 6px rgba(14, 20, 48, 0.4);
    opacity: 0.7;
}

/* ============================================================
   Section: Opening passage
   ============================================================ */
.opening {
    position: relative;
    padding: 128px 96px;
    overflow: hidden;
}

.opening-inner {
    max-width: 720px;
    margin-left: 8%;
}

.opening-paragraph {
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--vellum);
    margin-bottom: 28px;
    opacity: 0.92;
}

.opening-paragraph:first-letter {
    font-size: 44px;
    font-weight: 700;
    color: var(--lilac);
    line-height: 1;
    margin-right: 6px;
    float: left;
    padding-top: 6px;
}

/* ============================================================
   Section: Works (inflated cards)
   ============================================================ */
.works {
    position: relative;
    padding: 96px;
    padding-top: 64px;
    overflow: hidden;
}

.section-heading {
    font-family: 'Outfit', sans-serif;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--vellum);
    margin-bottom: 64px;
    margin-left: 8%;
    text-shadow:
        2px 2px 0 rgba(14, 20, 48, 0.4),
        0 6px 16px rgba(14, 20, 48, 0.5);
}

.section-heading-soft {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--vellum);
    opacity: 0.85;
    margin-bottom: 56px;
    margin-left: 8%;
    text-align: left;
}

/* Cards column — 7-of-12 columns, breathing room on right */
.cards-column {
    display: flex;
    flex-direction: column;
    gap: 56px;
    max-width: 60%;
    margin-left: 8%;
    position: relative;
    z-index: 5;
}

.card-inflated {
    display: flex;
    gap: 28px;
    padding: 28px;
    border-radius: 28px;
    background:
        radial-gradient(
            ellipse at 30% 25%,
            rgba(244, 236, 223, 0.06),
            rgba(59, 91, 181, 0.32) 45%,
            rgba(14, 20, 48, 0.5) 95%
        );
    box-shadow:
        var(--inset-light),
        var(--inset-shadow),
        var(--outer-drop);
    transition: transform 600ms var(--settle), box-shadow 600ms var(--settle);
    align-items: center;
}

.card-inflated:hover {
    transform: translateY(-2px);
    box-shadow:
        var(--inset-light),
        var(--inset-shadow),
        0 22px 48px rgba(14, 20, 48, 0.55);
}

.card-thumb {
    flex: 0 0 200px;
    height: 140px;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(14, 20, 48, 0.5);
    box-shadow:
        inset 1px 1px 3px rgba(244, 236, 223, 0.12),
        inset -1px -1px 4px rgba(14, 20, 48, 0.6);
    position: relative;
}

.card-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card-body {
    flex: 1;
    min-width: 0;
}

.card-meta {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--mint);
    display: block;
    margin-bottom: 10px;
    opacity: 0.85;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--vellum);
    margin-bottom: 10px;
}

.card-text {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--vellum);
    opacity: 0.78;
}

/* ============================================================
   Section: Diagram (cartography of a thought)
   ============================================================ */
.diagram {
    position: relative;
    padding: 128px 96px;
    overflow: hidden;
}

.diagram-frame {
    max-width: 60%;
    margin-left: 8%;
    padding: 32px;
    border-radius: 32px;
    background:
        radial-gradient(
            ellipse at 30% 25%,
            rgba(244, 236, 223, 0.04),
            rgba(59, 91, 181, 0.2) 50%,
            rgba(14, 20, 48, 0.4)
        );
    box-shadow:
        var(--inset-light),
        var(--inset-shadow),
        var(--outer-drop);
}

.diagram-circuit {
    width: 100%;
    height: auto;
    display: block;
}

.diagram-trace {
    fill: none;
    stroke: var(--mint);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.diagram-trace.draw {
    animation: trace-draw 6s var(--settle) forwards;
}

@keyframes trace-draw {
    to { stroke-dashoffset: 0; }
}

.diagram-pad {
    fill: var(--mint);
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(95, 211, 184, 0.7));
    transform-origin: center;
}

.diagram-pad.lit {
    opacity: 1;
    animation: pad-breathe 4s ease-in-out infinite;
}

@keyframes pad-breathe {
    0%, 100% { opacity: 0.65; }
    50%      { opacity: 1; }
}

.circuit-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    fill: var(--vellum);
    opacity: 0;
    text-anchor: middle;
    transition: opacity 1200ms var(--settle);
}

.circuit-label.shown {
    opacity: 0.78;
}

/* ============================================================
   Section: Closing letter
   ============================================================ */
.closing {
    position: relative;
    padding: 128px 96px;
    overflow: hidden;
}

.closing-inner {
    max-width: 720px;
    margin-left: 8%;
}

.closing-paragraph {
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--vellum);
    margin-bottom: 28px;
    opacity: 0.92;
}

.closing-signature {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--mint);
    margin-top: 48px;
    opacity: 0.85;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    position: relative;
    padding: 96px;
    padding-bottom: 64px;
    min-height: 200px;
    overflow: hidden;
}

.footer-inner {
    position: relative;
    z-index: 5;
    margin-left: 8%;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Inflated polar-mint diode */
.diode {
    position: relative;
    width: 28px;
    height: 28px;
    display: inline-block;
    border-radius: 50%;
}

.diode-glow {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(95, 211, 184, 0.6), rgba(95, 211, 184, 0) 70%);
    animation: diode-pulse 4s ease-in-out infinite;
}

.diode-core {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #c4f0e0, var(--mint) 55%, #2f9d7f 100%);
    box-shadow:
        inset 2px 2px 4px rgba(244, 236, 223, 0.4),
        inset -2px -2px 4px rgba(14, 20, 48, 0.4),
        0 0 18px rgba(95, 211, 184, 0.7),
        0 8px 22px rgba(14, 20, 48, 0.4);
}

@keyframes diode-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.15); }
}

.footer-stamp {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--vellum);
    opacity: 0.7;
}

/* ============================================================
   Shake-error pattern (reserved for form-field validation)
   Implemented as a class so JS can apply it to any inflated element.
   ============================================================ */
@keyframes shake-error {
    0%   { transform: translateX(0); border-color: var(--mint); }
    20%  { transform: translateX(-6px); border-color: #FF8B7B; }
    40%  { transform: translateX(6px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); border-color: #FF8B7B; }
    100% { transform: translateX(0); border-color: var(--mint); }
}

.shake-error {
    animation: shake-error 240ms ease-in-out;
    border: 1.5px solid var(--mint);
}

/* ============================================================
   Responsive (graceful degradation only)
   ============================================================ */
@media (max-width: 960px) {
    .masthead {
        padding: 48px 32px;
        padding-top: 18vh;
    }
    .masthead-inner {
        max-width: 100%;
    }
    .wordmark {
        font-size: 64px;
    }
    .opening, .works, .diagram, .closing, .site-footer {
        padding-left: 32px;
        padding-right: 32px;
    }
    .cards-column, .diagram-frame, .opening-inner, .closing-inner, .footer-inner {
        max-width: 100%;
        margin-left: 0;
    }
    .section-heading, .section-heading-soft {
        margin-left: 0;
    }
    .card-inflated {
        flex-direction: column;
        align-items: stretch;
    }
    .card-thumb {
        flex: 0 0 auto;
        width: 100%;
    }
    body {
        cursor: auto;
    }
    .cursor-bead, .cursor-trace {
        display: none;
    }
    .nav-pill {
        top: 16px;
        left: 16px;
        padding: 10px 16px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .diagram-trace {
        stroke-dashoffset: 0;
    }
    .diagram-pad {
        opacity: 1;
    }
    .circuit-label {
        opacity: 0.78;
    }
}
