/* ==========================================================================
   counter.js — a small terminal/IDE theme, built with CSS alone.
   No HTML changes: everything (titlebar, prompts, cursor) is generated
   with ::before / ::after against the existing elements and IDs.
   Palette: Ayu-Dark-inspired — ink-blue panel, amber/teal/green/red accents.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --bg-page:     #0d0f13;
    --bg-window:   #171a21;
    --bg-panel:    #1d212a;

    --border:      #2a2f3a;
    --border-soft: #22262f;

    --text:        #cdd3de;
    --text-dim:    #7d8494;
    --text-faint:  #4b5262;

    --amber:  #e6b450;
    --teal:   #5ccfe6;
    --green:  #aad94c;
    --red:    #f28779;
    --purple: #d4a7fc;

    --font-display: "JetBrains Mono", "Fira Code", monospace;
    --font-body:    "IBM Plex Mono", "JetBrains Mono", monospace;

    --radius: 8px;
}

* {
    box-sizing: border-box;
}

/* ---------------------------------- the whole page IS the window ---------------------------------- */

html {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
}

body {
    position: relative;
    width: 80%;
    height: 80vh;
    margin: 0;
    padding: 44px 30px 34px;
    overflow-y: auto;
    background: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.02);
    font-family: var(--font-body);
    color: var(--text);
    background-image:
        radial-gradient(circle at 15% -10%, rgba(92, 207, 230, 0.05), transparent 40%),
        radial-gradient(circle at 100% 110%, rgba(230, 180, 80, 0.05), transparent 45%);
}

/* fake titlebar: traffic lights + filename tab, drawn on the top edge */

body::before {
    content: "counter.js";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 34px;
    display: flex;
    align-items: center;
    padding: 0 14px 0 86px;
    background-color: var(--bg-panel);
    background-image:
        radial-gradient(circle 5px at 20px 17px, #f26d78 100%, transparent 101%),
        radial-gradient(circle 5px at 40px 17px, #e6b450 100%, transparent 101%),
        radial-gradient(circle 5px at 60px 17px, #a6cc70 100%, transparent 101%);
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 12px;
    color: var(--text-dim);
}

/* fake console prompt at the bottom, with a blinking cursor */

body::after {
    content: "> ready_";
    display: block;
    margin-top: 26px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--teal);
    animation: blink-cursor 1.1s step-end infinite;
}

@keyframes blink-cursor {
    50% { opacity: 0.35; }
}

/* ---------------------------------- headings ---------------------------------- */

h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
}

/* "Welcome to the counter game" reads as a code comment */

#hero-line {
    font-size: 14px;
    font-style: italic;
    color: var(--text-dim);
    margin-bottom: 22px;
}

#hero-line::before {
    content: "// ";
    color: var(--text-faint);
    font-style: normal;
}

/* the counter itself reads as a live variable assignment */

#counter {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 44px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    margin-bottom: 28px;
}

#counter::before {
    content: "let count =";
    font-size: 14px;
    font-weight: 400;
    color: var(--purple);
}

#counter::after {
    content: ";";
    font-size: 44px;
    color: var(--text-dim);
}

/* ---------------------------------- buttons ---------------------------------- */

button {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    margin: 0 10px 10px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

button::before {
    content: "> ";
    color: var(--text-faint);
}

button:hover {
    transform: translateY(-1px);
    border-color: var(--border-soft);
}

button:active {
    transform: translateY(0);
}

button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

#increment {
    color: var(--green);
    border-color: rgba(170, 217, 76, 0.25);
}
#increment:hover {
    background: rgba(170, 217, 76, 0.08);
    border-color: rgba(170, 217, 76, 0.45);
}

#decrement {
    color: var(--red);
    border-color: rgba(242, 135, 121, 0.25);
}
#decrement:hover {
    background: rgba(242, 135, 121, 0.08);
    border-color: rgba(242, 135, 121, 0.45);
}

#reset {
    color: var(--text-dim);
}
#reset:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-soft);
}

/* ---------------------------------- responsive ---------------------------------- */

@media (max-width: 480px) {
    body {
        padding: 40px 20px 28px;
    }
    #counter { font-size: 34px; }
    #counter::after { font-size: 34px; }
    button { padding: 9px 13px; font-size: 12.5px; }
}

/* ---------------------------------- motion preference ---------------------------------- */

@media (prefers-reduced-motion: reduce) {
    body::after { animation: none; opacity: 1; }
    button { transition: none; }
}