/* Shared custom styles for Glyph Arts & Technology.
   Design tokens live in assets/config.js; this file is hand-written CSS. */

body {
    background-color: #f9f9f9;
    color: #1b1b1b;
    font-family: 'Geist', sans-serif;
    min-height: max(884px, 100dvh);
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Display serif (Fraunces) for headlines, the desktop nav, and the wordmark.
   Forcing opsz to its max gives the dramatic thick/thin contrast of the
   "Machine Age Modernism" reference even at smaller sizes; SOFT/WONK stay at 0
   for the sharper, more modern cut. */
.font-headline-lg,
.font-headline-md,
.font-headline-lg-mobile {
    font-optical-sizing: auto;
    font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
}

.technical-grid {
    background-image: linear-gradient(#cfc4c5 1px, transparent 1px), linear-gradient(90deg, #cfc4c5 1px, transparent 1px);
    background-size: 20px 20px;
}

.bento-card {
    border: 1px solid #1b1b1b;
    background: #ffffff;
    transition: transform 0.1s ease;
}
.bento-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #1b1b1b;
}

/* Reveal choreography (assets/reveal.js adds/removes these classes).
   Gated behind no-preference so reduced-motion users never see hidden state. */
@media (prefers-reduced-motion: no-preference) {
    .reveal-pending {
        opacity: 0;
        transform: translateY(14px);
    }
    .reveal-pending.reveal-in {
        opacity: 1;
        transform: translateY(0);
        transition:
            opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
            transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

/* Hard stop for every animation/transition when the OS asks for less motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------------------------------------------------------------------------
   Mobile refinements. The bottom nav was removed (the hamburger now holds the
   full site nav), so these handle the remaining small-screen issues:
   typeset math overflow, crowded simulation stages, and cramped controls.
   --------------------------------------------------------------------------- */

/* Typeset math must never widen the page. Display equations scroll sideways
   inside their own box instead of pushing the layout. Applies everywhere
   (course notes AND the sim/study pages), not just .note-prose. */
mjx-container[display="true"] {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

@media (max-width: 640px) {
    /* Interactive canvases are 16:9 on desktop, which is too short on a phone:
       the HUD overlay swamps the drawing. Give them a taller 4:3 box so the
       machine and the readout both have room. Only the interactive stages
       carry BOTH hero-canvas and aspect-video, so the homepage hero and the
       art figures are untouched. */
    .hero-canvas.aspect-video {
        aspect-ratio: 4 / 3;
    }

    /* Control bars (any card that holds a range slider): stack each slider on
       its own full-width row so it is actually draggable, while buttons keep
       wrapping normally. */
    .bento-card:has(input[type="range"]) {
        row-gap: 10px;
    }
    .bento-card:has(input[type="range"]) > label {
        width: 100%;
        justify-content: space-between;
    }
    .bento-card:has(input[type="range"]) label > input[type="range"] {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        margin-left: 10px;
    }

    /* Shrink the readout panel so it stops swamping the machine on a small
       stage. It keeps its anchored corner; only the two anchors exist. */
    .hero-canvas.aspect-video .absolute.border {
        transform: scale(0.8);
    }
    .hero-canvas.aspect-video .absolute.border.left-0 {
        transform-origin: top left;
    }
    .hero-canvas.aspect-video .absolute.border.right-0 {
        transform-origin: top right;
    }
}

/* Live-code terminal blocks (assets/term-playground.js).
   iTerm2-style dark window with a powerlevel10k-style prompt bar; students
   edit the JS and run it against the block's own canvas. Corners stay square
   to match the site's shape system; only the traffic lights are round. */
.term-window {
    background: #16181d;
    border: 1px solid #1b1b1b;
    font-family: 'JetBrains Mono', monospace;
}
.term-titlebar {
    display: flex; align-items: center; gap: 8px;
    background: #0e1013;
    padding: 8px 12px;
    border-bottom: 1px solid #23262c;
}
.term-dot { width: 12px; height: 12px; border-radius: 50%; }
.term-dot.r { background: #ff5f57; }
.term-dot.y { background: #febc2e; }
.term-dot.g { background: #28c840; }
.term-title {
    flex: 1; text-align: center;
    color: #8b939e; font-size: 11px; letter-spacing: 0.04em;
}
.term-prompt {
    display: flex; align-items: center;
    background: #16181d;
    padding: 8px 12px 0;
    font-size: 12px; line-height: 1;
    white-space: nowrap; overflow: hidden;
}
.term-seg { padding: 5px 10px; display: inline-flex; align-items: center; }
.term-seg.dir { background: #2a6fb0; color: #eef3f8; }
.term-seg.git { background: #4e9a3d; color: #0e1013; }
.term-caret-sep { width: 0; height: 0; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.term-caret-sep.a { border-left: 9px solid #2a6fb0; }
.term-caret-sep.b { border-left: 9px solid #4e9a3d; }
.term-chevron { color: #4e9a3d; font-weight: 700; margin-left: 10px; }
.term-status { margin-left: auto; font-size: 11px; color: #8b939e; }
.term-status.ok { color: #28c840; }
.term-status.err { color: #ff5f57; }
.term-editor {
    display: block; width: 100%;
    background: transparent; border: 0; resize: vertical;
    color: #e6e1d7; caret-color: #d43f00;
    font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.55;
    padding: 10px 12px; min-height: 11rem;
    white-space: pre; overflow-x: auto;
}
.term-editor:focus { outline: 1px solid #2a6fb0; outline-offset: -1px; }
.term-stage {
    background: #0e1013;
    border-left: 1px solid #23262c;
    display: flex; align-items: center; justify-content: center;
}
.term-stage canvas { display: block; }
.term-console {
    border-top: 1px solid #23262c;
    padding: 8px 12px; min-height: 30px; max-height: 108px; overflow-y: auto;
    font-size: 11px; line-height: 1.6; color: #98c379;
}
.term-console .err { color: #ff6b66; }
.term-actions {
    display: flex; gap: 8px; align-items: center;
    padding: 8px 12px; border-top: 1px solid #23262c;
}
.term-btn {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.06em;
    text-transform: uppercase; padding: 6px 14px; cursor: pointer;
    background: transparent; transition: background 75ms, color 75ms;
}
.term-btn.run { border: 1px solid #28c840; color: #28c840; }
.term-btn.run:hover { background: #28c840; color: #0e1013; }
.term-btn.run:active { transform: translateY(1px); }
.term-btn.reset { border: 1px solid #8b939e; color: #8b939e; }
.term-btn.reset:hover { background: #8b939e; color: #0e1013; }
.term-hint { margin-left: auto; font-size: 10px; color: #565e68; text-transform: uppercase; letter-spacing: 0.06em; }

/* Blinking terminal cursor used in the SHOP_LOG card */
.shop-log-cursor::after {
    content: '_';
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Placeholder texture for image slots until real shop/hero photos are added.
   To use a photo: add style="background-image:url('assets/img/whatever.jpg')" to the element. */
.photo-slot {
    background-color: #e8e8e8;
    background-image: repeating-linear-gradient(45deg, #dadada 0, #dadada 2px, transparent 2px, transparent 12px);
}

/* Ridgeline silhouette (legacy hero fallback — kept for reuse) */
.ridgeline {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 55%;
}

/* Hero backdrop for the animated robot-arm wireframe: a faint dot grid so the
   line-art reads like a technical drawing. See assets/robot-arm.js. */
.hero-canvas {
    background-color: #f4f4f2;
    background-image: radial-gradient(#cfc4c5 1px, transparent 1.4px);
    background-size: 16px 16px;
}
/* Robot strokes never take pointer events (the whole card is a link target). */
#robot-arm { pointer-events: none; }

/* Rendered-Markdown notes (see machine-design-notes.html + notes/*.md).
   Styles the HTML that marked.js generates so it matches the site. */
.note-prose h1 {
    font-family: 'Fraunces', serif;
    font-optical-sizing: auto;
    font-variation-settings: 'opsz' 144;
    text-transform: uppercase;
    font-size: 32px; line-height: 1.1; letter-spacing: -0.02em;
    margin: 0 0 12px;
}
.note-prose h2 {
    font-family: 'Fraunces', serif;
    font-optical-sizing: auto;
    font-variation-settings: 'opsz' 144;
    text-transform: uppercase;
    font-size: 24px; line-height: 1.15;
    margin: 28px 0 10px; padding-top: 16px;
    border-top: 1px solid #cfc4c5;
}
.note-prose h2:first-of-type { border-top: none; padding-top: 0; }
.note-prose p { font-size: 16px; line-height: 1.6; margin: 0 0 12px; color: #1b1b1b; }
.note-prose ul { list-style: disc; padding-left: 22px; margin: 0 0 12px; color: #4c4546; }
.note-prose li { margin-bottom: 6px; }
.note-prose strong { color: #1b1b1b; font-weight: 600; }
.note-prose em { font-style: italic; }
.note-prose a { color: #aa3000; text-decoration: underline; }
.note-prose code {
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    background: #eeeeee; padding: 1px 5px; border: 1px solid #e2e2e2;
}
.note-prose hr { border: none; border-top: 1px solid #cfc4c5; margin: 24px 0; }
.note-prose mjx-container[display="true"] { margin: 14px 0; overflow-x: auto; overflow-y: hidden; }
