/* Logical Consequence */

:root {
    --text: #f5f5f7;
    --muted: rgba(245, 245, 247, .68);
    --card: rgba(30, 36, 52, .78);
    --line: rgba(255, 255, 255, .12);
    --good: #7be0a5;
    --bad: #ff8f87;
    --accent: #ffd27a;
    --wood-light: #edc28f;
    --wood: #dca46a;
    --wood-dark: #b7803f;
    --leg: #8a5a32;
    --leg-back: #6b4426;
    --panel: #9a673a;
    --panel-side: #b07a45;
}

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

html {
    min-height: 100%;
    background: linear-gradient(135deg, #ea5c54 0%, #bb6dec 100%) fixed;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    font-family: 'Dosis', system-ui, sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.45;
    color: var(--text);
}

a {
    color: var(--accent);
}

/* Card */

.card {
    width: 100%;
    max-width: 820px;
    padding: 28px;
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 20px 50px rgba(20, 10, 40, .35);
    backdrop-filter: blur(6px);
}

.header {
    text-align: center;
    margin-bottom: 22px;
}

.header h1 {
    font-weight: 700;
    font-size: 30px;
    letter-spacing: .5px;
}

.header p {
    max-width: 560px;
    margin: 6px auto 0;
    color: var(--muted);
}

/* Workshop: the picture and the parts */

.workshop {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
    align-items: center;
}

.stage {
    text-align: center;
}

#scene {
    width: 100%;
    max-width: 330px;
    height: auto;
    overflow: visible;
}

.stage figcaption {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.stage .label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
}

#object-name {
    font-size: 30px;
    font-weight: 700;
    color: var(--accent);
}

#object-name.pop {
    animation: pop .45s ease;
}

#object-description {
    color: var(--muted);
    min-height: 2.9em;
}

@keyframes pop {
    0% { transform: scale(.8); opacity: .2; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

/* Scene */

.shadow { fill: rgba(0, 0, 0, .22); }
.plank-top { fill: var(--wood-light); }
.plank-front { fill: var(--wood); }
.plank-side { fill: var(--wood-dark); }
.grain { stroke: var(--wood-dark); stroke-width: 1.2; stroke-linecap: round; opacity: .55; }
.leg { fill: var(--leg); }
.leg.back { fill: var(--leg-back); }
.panel.back { fill: var(--panel); }
.panel.side { fill: var(--panel-side); }
.panel.bottom { fill: var(--wood-dark); }
.shelf { fill: var(--wood); }
.door { fill: var(--wood); stroke: var(--wood-dark); stroke-width: 2; }
.door-inset { fill: none; stroke: var(--wood-dark); stroke-width: 1.5; opacity: .7; }
.knob { fill: #5b3a1f; }

.part {
    opacity: 0;
    transform: translateY(-14px);
    transition: opacity .35s ease, transform .35s ease;
}

.part.on {
    opacity: 1;
    transform: none;
}

/* a part that was chosen but has nothing to attach to: a faint ghost */
.part.blocked {
    opacity: .16;
    transform: translateY(-6px);
    filter: grayscale(1);
}

/* Parts */

.parts {
    border: none;
}

.parts legend {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 10px;
}

.toggle {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.toggle:hover {
    background: rgba(255, 255, 255, .06);
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle .box {
    flex: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--muted);
    border-radius: 6px;
    transition: background .2s, border-color .2s;
}

.toggle input:checked + .box {
    background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%231e2434' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
    border-color: var(--good);
}

.toggle input:focus-visible + .box {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.toggle .name {
    font-weight: 500;
}

.toggle .hint {
    flex-basis: 100%;
    padding-left: 34px;
    font-size: 14px;
    color: var(--bad);
}

.toggle .hint:empty {
    display: none;
}

.toggle.blocked {
    border-color: rgba(255, 143, 135, .55);
}

.toggle.blocked input:checked + .box {
    background-color: var(--bad);
    border-color: var(--bad);
}

.reset {
    margin-top: 6px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
}

.reset:hover,
.reset:focus-visible {
    color: var(--text);
    border-color: var(--muted);
}

/* Reasoning */

.reasoning {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.reasoning h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.steps {
    list-style: none;
    display: grid;
    gap: 6px;
}

.step {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--muted);
}

.step .icon {
    width: 16px;
    text-align: center;
    font-weight: 700;
}

.step .op {
    color: var(--accent);
    padding: 0 3px;
}

.step.applied {
    color: var(--text);
    background: rgba(123, 224, 165, .12);
}

.step.applied .icon { color: var(--good); }

.step.blocked {
    color: var(--text);
    background: rgba(255, 143, 135, .12);
}

.step.blocked .icon { color: var(--bad); }

.step.idle { opacity: .55; }

.step .note {
    flex-basis: 100%;
    padding-left: 26px;
    font-size: 14px;
    color: var(--bad);
}

.conclusion {
    margin-top: 14px;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
}

.noscript {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    text-align: center;
}

/* Small screens */

@media (max-width: 680px) {
    .card { padding: 20px 16px; }
    .workshop { grid-template-columns: 1fr; }
    .header h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    .part, #object-name.pop { transition: none; animation: none; }
}
