/* ============================================================================
   Hipster AI Ipsum — "Tool 03"
   Chrome styled to match Sumobaby (sumobaby.net). Tokens pulled from the live
   theme: brand blue #004aad, paper #f6f6f6, ink #191919, accent #feffb9,
   body type Lekton (mono), headings Helvetica Neue (uppercase). The container
   stays straight-faced and professional; the humour lives in the output text.
   ========================================================================= */

:root {
    --brand: #004aad;
    --brand-ink: #003a87;
    --brand-tint: #e7eefa;

    --ink: #191919;
    --paper: #f6f6f6;
    --white: #ffffff;
    --accent: #feffb9;

    --muted: #5c5f66;
    --line: #e3e4e7;
    --line-strong: #c9cbd0;

    --font-head: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-body: "Lekton", ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

    --radius: 10px;
    --radius-lg: 16px;
    --maxw: 1080px;
    --shadow: 0 1px 2px rgba(25, 25, 25, .04), 0 8px 24px rgba(25, 25, 25, .06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .01em;
    line-height: 1.02;
    margin: 0;
}

/* Visible focus everywhere — accessibility (6.6). */
:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: var(--white);
    padding: 10px 16px;
    z-index: 100;
    border-radius: 0 0 var(--radius) 0;
}

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

/* ---- Header --------------------------------------------------------------- */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.site-header__inner,
.site-footer__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 1.25rem;
    color: var(--ink);
}

.brand:hover {
    text-decoration: none;
}

.brand__dot {
    color: var(--brand);
}

.site-nav {
    display: flex;
    gap: 22px;
    margin-left: auto;
    font-size: .95rem;
}

.site-nav a {
    color: var(--ink);
    letter-spacing: .02em;
}

.site-nav a[aria-current="page"] {
    color: var(--brand);
    font-weight: 700;
}

.cta {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .78rem;
    font-weight: 700;
    color: var(--white);
    background: var(--brand);
    padding: 11px 16px;
    border-radius: 999px;
}

.cta:hover {
    background: var(--brand-ink);
    text-decoration: none;
}

/* ---- Tool intro ----------------------------------------------------------- */
.tool {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 24px 72px;
}

.breadcrumb {
    font-size: .85rem;
    letter-spacing: .04em;
    color: var(--muted);
    margin: 0 0 24px;
    display: flex;
    gap: 8px;
}

.breadcrumb a {
    color: var(--muted);
}

.tool-head {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 32px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--line);
}

.tool-head__num {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(3rem, 9vw, 5.5rem);
    line-height: .82;
    color: var(--brand);
    letter-spacing: -.02em;
}

h1 {
    font-size: clamp(2rem, 5.5vw, 3.4rem);
    margin: 0 0 12px;
}

.lede {
    max-width: 60ch;
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

/* ---- Workspace layout ----------------------------------------------------- */
.workspace {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 28px;
    align-items: start;
}

/* ---- Controls ------------------------------------------------------------- */
.controls {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 24px;
    display: grid;
    gap: 22px;
}

.controls__row {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field > label,
.field__head label {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink);
}

.field__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

select,
input[type="number"] {
    font: inherit;
    width: 100%;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    appearance: none;
}

select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
    cursor: pointer;
}

select:focus,
input[type="number"]:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-tint);
}

.field--narrow input {
    max-width: 120px;
}

.field__hint {
    margin: 0;
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.4;
}

/* ---- Presets (compose the existing controls) ------------------------------ */
.presets {
    display: grid;
    gap: 10px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.presets__label {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink);
}

.presets__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.preset {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 9px 10px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.preset:hover {
    color: var(--brand);
    border-color: var(--brand);
}

.preset[aria-pressed="true"] {
    background: var(--brand-tint);
    border-color: var(--brand);
    color: var(--brand-ink);
}

/* Chaos slider — the hero interaction. */
#chaos-readout {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--line-strong);
    background-image: linear-gradient(var(--brand), var(--brand));
    background-repeat: no-repeat;
    background-size: 50% 100%;  /* JS updates this to reflect value */
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--white);
    box-shadow: 0 1px 4px rgba(25, 25, 25, .3);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--white);
}

input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: var(--line-strong);
}

input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--brand);
}

.slider-scale {
    display: flex;
    justify-content: space-between;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

/* "I'm baby" toggle. */
.switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: .92rem;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch__track {
    flex: 0 0 auto;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--line-strong);
    position: relative;
    transition: background .15s ease;
}

.switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(25, 25, 25, .3);
    transition: transform .15s ease;
}

.switch input:checked + .switch__track {
    background: var(--brand);
}

.switch input:checked + .switch__track .switch__thumb {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

.switch__label {
    font-weight: 400;
}

/* ---- Buttons -------------------------------------------------------------- */
.controls__actions {
    display: flex;
    gap: 10px;
}

/* Sits directly under the actions; pull it up so it reads as a caption for the
   buttons rather than another full-gap row in the controls grid. */
.controls__hint {
    margin-top: -14px;
}

.btn {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .78rem;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid var(--ink);
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.btn:hover {
    background: var(--ink);
    color: var(--white);
}

.btn--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--white);
    flex: 1;
}

.btn--primary:hover {
    background: var(--brand-ink);
    border-color: var(--brand-ink);
}

.btn--ghost {
    border-color: var(--line-strong);
    padding: 8px 14px;
    font-size: .72rem;
}

.btn:disabled {
    opacity: .5;
    cursor: progress;
}

/* ---- Output --------------------------------------------------------------- */
.output {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

.output__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.output__title {
    font-size: .9rem;
    letter-spacing: .1em;
    color: var(--muted);
}

.output__tools {
    display: flex;
    gap: 8px;
}

.paragraphs {
    padding: 26px 28px;
    display: grid;
    gap: 18px;
    flex: 1;
}

.paragraphs.is-loading {
    opacity: .45;
    transition: opacity .15s ease;
}

.para {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
}

.para p {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.7;
}

.para__copy {
    opacity: 0;
    flex: 0 0 auto;
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .66rem;
    font-weight: 700;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 5px 10px;
    cursor: pointer;
    transition: opacity .12s ease, color .12s ease, border-color .12s ease;
}

.para:hover .para__copy,
.para__copy:focus-visible,
.para__copy.is-done {
    opacity: 1;
}

.para__copy:hover {
    color: var(--brand);
    border-color: var(--brand);
}

.para__copy.is-done {
    color: var(--brand);
    border-color: var(--brand);
}

.output__meta {
    margin: 0;
    padding: 14px 28px 22px;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.output__meta code {
    color: var(--ink);
}

/* Toast for copy confirmations. */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--ink);
    color: var(--white);
    font-size: .85rem;
    padding: 10px 18px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 50;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--white);
    margin-top: 40px;
}

.site-footer__inner {
    flex-wrap: wrap;
    align-items: center;
}

.site-footer__brand {
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0;
}

.site-footer__links {
    display: flex;
    gap: 18px;
    font-size: .9rem;
}

.site-footer__links a {
    color: var(--ink);
}

.site-footer__legal {
    width: 100%;
    margin: 4px 0 0;
    font-size: .8rem;
    color: var(--muted);
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .controls {
        position: static;
    }

    .site-nav {
        display: none;
    }
}

@media (max-width: 560px) {
    .tool {
        padding: 28px 18px 56px;
    }

    .tool-head {
        gap: 16px;
    }

    .cta {
        display: none;
    }

    .controls__row {
        grid-template-columns: 1fr;
    }

    .para {
        grid-template-columns: 1fr;
    }

    .para__copy {
        opacity: 1;
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
