/*
 * The Dárkomat (the quiz that finds a gift for a man or a woman) drawn as a robot: a head with an antenna and eyes, arms and legs, a body with a display (the
 * question), buttons (the answers) and a slot the result drops out of. Only the page of the quiz loads it. The drawing is made of the classes of the
 * parts (robot-metal, robot-metal-dark, ...), so both themes only change the colours below; the display is dark in both, like a real one.
 */


.robot,
.darkomat-promo {
    --robot-metal: #cfdcec;
    --robot-metal-dark: #a6bad6;
    --robot-line: #14325c;
    --robot-screen: #0d2438;
    --robot-glow: #7dffb0;
    --robot-bulb: #ffd54f;
    --robot-key: #ffffff;
    --robot-key-border: #b7c9e4;
    --robot-key-hover: #fff6d6;
    --robot-key-text: #0b2140;
    --robot-progress: #19b45f;
    --robot-accent: var(--brand);
    --robot-chip: #e3ecfa;
}

/* the Dárkomat for women is pink: the colours are the only thing that differs (the drawing and the buttons are the same) */
.robot[data-audience="zeny"],
.darkomat-promo[data-audience="zeny"] {
    --robot-metal: #f7d6e6;
    --robot-metal-dark: #e6aecb;
    --robot-line: #5a1a40;
    --robot-screen: #2b1024;
    --robot-glow: #ffb3dc;
    --robot-key-border: #e6aecb;
    --robot-key-hover: #ffe9f4;
    --robot-key-text: #3d0f2a;
    --robot-progress: #d6338a;
    --robot-accent: #b0165f;
    --robot-chip: #fbe3ef;
}

.robot {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 34rem;
    margin: 1.25rem auto 1rem;
}

/* the arm that waves swings out of the body: on a narrow screen the tip of it must not make the page wider (clip, not hidden: no scroll box is made) */
.quiz { overflow-x: clip; }

/* ---- the parts of the drawing ---- */
.robot svg { display: block; overflow: visible; }

.robot-metal,
.robot-metal-dark,
.robot-face {
    stroke: var(--robot-line);
    stroke-width: 4;
    stroke-linejoin: round;
}

.robot-metal { fill: var(--robot-metal); }
.robot-metal-dark { fill: var(--robot-metal-dark); }
.robot-face { fill: var(--robot-screen); }

.robot-line {
    stroke: var(--robot-line);
    stroke-width: 4;
    stroke-linecap: round;
}

.robot-bulb {
    fill: var(--robot-bulb);
    stroke: var(--robot-line);
    stroke-width: 3;
    animation: robot-glow 2.4s ease-in-out infinite;
}

.robot-eye { fill: var(--robot-glow); transform-box: fill-box; transform-origin: center; animation: robot-blink 5s infinite; }

.robot-mouth {
    fill: none;
    stroke: var(--robot-glow);
    stroke-width: 5;
    stroke-linecap: round;
}

.robot-mouth-happy,
.robot[data-mood="happy"] .robot-mouth-idle { display: none; }
.robot[data-mood="happy"] .robot-mouth-happy { display: inline; }

.robot-head { width: 9.5rem; height: auto; margin-bottom: -.6rem; position: relative; z-index: 1; }
.robot-legs { width: 12rem; height: auto; margin-top: -.5rem; }

/* ---- the body ---- */
.robot-torso {
    position: relative;
    width: 100%;
    padding: 1rem 1.1rem 1.2rem;
    border: 4px solid var(--robot-line);
    border-radius: 26px;
    background: linear-gradient(180deg, var(--robot-metal), var(--robot-metal-dark));
    box-shadow: 0 6px 0 rgba(20, 50, 92, .18);
}

.robot-arm {
    position: absolute;
    top: 1.6rem;
    width: 2.4rem;
    height: auto;
    transform-origin: 50% 10%;
}

.robot-arm-left { left: -2.9rem; transform: rotate(8deg); }
.robot-arm-right { right: -2.9rem; transform: rotate(-8deg) scaleX(-1); animation: robot-wave 3s ease-in-out infinite; }

.robot-lights {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .75rem;
}

.robot-led {
    width: .85rem;
    height: .85rem;
    border: 2px solid var(--robot-line);
    border-radius: 50%;
    animation: robot-glow 2.4s ease-in-out infinite;
}

.robot-led-a { background: #ff6b6b; }
.robot-led-b { background: #ffd54f; animation-delay: .8s; }
.robot-led-c { background: #4cd98b; animation-delay: 1.6s; }

.robot-vent {
    position: relative;
    flex: 1;
    height: .7rem;
    margin-left: .5rem;
    overflow: hidden;
    border-radius: 4px;
}

/* the bars of the body: the grey ones are all the questions, the green ones the part the visitor has already answered */
.robot-vent::before,
.robot-vent-fill {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    background: repeating-linear-gradient(90deg, var(--robot-line) 0 3px, transparent 3px 9px);
}

.robot-vent::before { right: 0; opacity: .4; }

.robot-vent-fill {
    background: repeating-linear-gradient(90deg, var(--robot-progress) 0 3px, transparent 3px 9px);
    transition: width .6s ease;
}

.robot-progress {
    margin-left: .55rem;
    color: var(--robot-line);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---- the display: what the robot asks ---- */
.robot-screen {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border: 4px solid var(--robot-line);
    border-radius: 16px;
    background: var(--robot-screen);
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--robot-glow) 18%, transparent);
}

.robot-text {
    margin: 0;
    color: var(--robot-glow);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.25;
    text-shadow: 0 0 8px color-mix(in srgb, var(--robot-glow) 45%, transparent);
}

/* ---- the buttons: the answers ---- */
.quiz-answers {
    display: grid;
    gap: .6rem;
}

.quiz-answer {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1rem;
    border: 3px solid var(--robot-key-border);
    border-bottom-width: 6px;
    border-radius: 14px;
    background: var(--robot-key);
    color: var(--robot-key-text);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, transform .1s;
}

.quiz-answer .bi {
    flex: 0 0 auto;
    font-size: 1.5rem;
    color: var(--robot-accent);
}

a.quiz-answer:hover,
a.quiz-answer:focus-visible {
    border-color: var(--robot-accent);
    background: var(--robot-key-hover);
    color: var(--robot-key-text);
    text-decoration: none;
}

a.quiz-answer:active {
    border-bottom-width: 3px;
    transform: translateY(3px);
}

.quiz-back { margin: 0 0 1.5rem; text-align: center; }

/* ---- the slot: where the result drops out ---- */
.robot-slot {
    position: relative;
    padding: 1.3rem .8rem .8rem;
    border: 4px solid var(--robot-line);
    border-radius: 16px;
    background: var(--robot-screen);
}

.robot-slot-flap {
    position: absolute;
    top: .45rem;
    left: 50%;
    width: 60%;
    height: .35rem;
    transform: translateX(-50%);
    border-radius: 4px;
    background: var(--robot-metal-dark);
}

.quiz-card {
    padding: 1.2rem 1rem 1.3rem;
    border: 3px solid var(--robot-line);
    border-radius: 14px;
    background: var(--robot-key);
    color: var(--robot-key-text);
    text-align: center;
    animation: robot-drop .7s cubic-bezier(.3, 1.4, .5, 1) both;
}

.quiz-title {
    margin: 0 0 .5rem;
    color: var(--robot-accent);
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
}

.quiz-title .bi { display: block; margin-bottom: .2rem; font-size: 3rem; }

.quiz-text { margin: 0 0 .6rem; font-size: 1.1rem; }

/* the line before the buttons to the tips: on its own line and in a lighter italic, so it does not read as a part of the description */
.quiz-hint {
    margin: 0 0 .9rem;
    font-size: .98rem;
    font-style: italic;
    font-weight: 600;
    opacity: .8;
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .6rem;
}

/* the buttons of different sizes keep their text in the middle (a plain button would hold it at the top when the row stretches it) */
.quiz-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

/* Restart: a light orange, like the reset button of a machine, so it is not the second grey button next to the others */
.btn.quiz-restart {
    border: 2px solid #f0a850;
    background: #ffe2bd;
    color: #6b3a00;
    font-weight: 700;
}

.btn.quiz-restart:hover,
.btn.quiz-restart:focus-visible {
    border-color: #e08a1e;
    background: #ffd199;
    color: #4d2800;
}

.quiz-heading {
    margin: .25rem 0 0;
    font-size: 1.4rem;
    text-align: center;
}

.quiz-prices { margin-top: 1.5rem; }

.quiz-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
}

.quiz-chip {
    padding: .4rem .85rem;
    border: 2px solid var(--robot-key-border);
    border-radius: 999px;
    background: var(--robot-chip);
    color: var(--robot-key-text);
    font-weight: 700;
    text-decoration: none;
}

a.quiz-chip:hover,
a.quiz-chip:focus-visible {
    border-color: var(--robot-accent);
    background: var(--robot-key-hover);
    color: var(--robot-key-text);
    text-decoration: none;
}

.quiz-outcome .info-cta { margin-top: 2rem; }

/* a link in the white card: the card is light in both themes, so the link has its own blue and an underline (the text around it has none) */
.quiz-card a.quiz-link:is(:link, :visited) {
    color: #0b4fb3;
    font-weight: 700;
    text-decoration: underline;
}

.quiz-card a.quiz-link:is(:hover, :focus-visible) { color: #073b88; }

/* ---- the life of the robot ---- */
@keyframes robot-blink {
    0%, 92%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(.1); }
}

@keyframes robot-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

@keyframes robot-wave {
    0%, 60%, 100% { transform: rotate(-8deg) scaleX(-1); }
    75% { transform: rotate(-28deg) scaleX(-1); }
    90% { transform: rotate(-14deg) scaleX(-1); }
}

@keyframes robot-drop {
    from { transform: translateY(-1.6rem); }
    to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .robot-bulb, .robot-led, .robot-eye, .robot-arm-right, .quiz-card { animation: none; }
    .quiz-answer { transition: none; }
    a.quiz-answer:active { transform: none; }
}

/* ---- a narrow screen: the arms are drawn closer, so the body keeps the width ---- */
@media (max-width: 575.98px) {
    .robot { padding: 0 1.6rem; }
    .robot-head { width: 8rem; }
    .robot-arm { width: 1.7rem; top: 1.2rem; }
    .robot-arm-left { left: -2.1rem; }
    .robot-arm-right { right: -2.1rem; }
    .robot-torso { padding: .8rem .75rem 1rem; }
    .robot-text { font-size: 1.2rem; }
    .quiz-answer { padding: .7rem .8rem; font-size: 1rem; }
    .quiz-title { font-size: 1.8rem; }
}

/* ---- the dark theme: a darker metal, the keys stay light so the text on them is read as before ---- */
html[data-theme="dark"] .robot,
html[data-theme="dark"] .darkomat-promo {
    --robot-progress: #7dffb0;
    --robot-metal: #33445c;
    --robot-metal-dark: #26354a;
    --robot-line: #6f93c4;
    --robot-key: #e9f0fb;
    --robot-key-border: #9db6da;
    --robot-key-hover: #fff2c4;
    --robot-key-text: #0b2140;
    --robot-accent: #14325c;
    --robot-chip: #e3ecfa;
}

/* the dark theme of the pink robot: a dark plum metal, the keys stay light */
html[data-theme="dark"] .robot[data-audience="zeny"],
html[data-theme="dark"] .darkomat-promo[data-audience="zeny"] {
    --robot-progress: #ff9fd2;
    --robot-metal: #5a3350;
    --robot-metal-dark: #46263f;
    --robot-line: #d68fb8;
    --robot-key: #fbeaf3;
    --robot-key-border: #d9a3c2;
    --robot-key-hover: #fff0c8;
    --robot-key-text: #3d0f2a;
    --robot-accent: #7a1a4c;
    --robot-chip: #fbe3ef;
}

html[data-theme="dark"] .robot-torso { box-shadow: 0 6px 0 rgba(0, 0, 0, .35); }
html[data-theme="dark"] .robot-slot { background: #08141f; }
html[data-theme="dark"] a.quiz-answer:is(:link, :visited),
html[data-theme="dark"] a.quiz-chip:is(:link, :visited) { color: var(--robot-key-text); }
html[data-theme="dark"] .quiz-card { border-color: #9db6da; }
html[data-theme="dark"] .quiz-title,
html[data-theme="dark"] .quiz-answer .bi { color: var(--robot-accent); }
html[data-theme="dark"] .btn.quiz-restart { border-color: #c98a35; background: #5a3a14; color: #ffd9a8; }
html[data-theme="dark"] .btn.quiz-restart:hover,
html[data-theme="dark"] .btn.quiz-restart:focus-visible { border-color: #e6a84f; background: #6d4618; color: #ffe6c4; }

/* ---- the small robot on the pages of the tips for men: the invitation to the quiz ---- */
.darkomat-promo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: .8rem 1rem;
    text-align: left; /* the home page centres its introduction */
    border: 3px solid var(--robot-line);
    border-radius: 18px;
    background: var(--robot-metal);
    color: var(--robot-key-text);
}

.darkomat-promo .robot-head {
    flex: 0 0 auto;
    width: 4.2rem;
    margin: 0;
}

.darkomat-promo .robot-mouth-idle { display: none; }
.darkomat-promo .robot-mouth-happy { display: inline; }

.darkomat-promo-text { flex: 1; min-width: 0; }

/* which Dárkomat it is (the robot for women is pink, see the variables at the top of the file) */
.darkomat-promo-label {
    display: block;
    margin-bottom: .1rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .75;
}

/* a robot with more buttons (it invites to every quiz): the buttons stand side by side */
.darkomat-promo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* the page of the quizzes: a robot for every quiz */
.darkomat-hub { margin: 1.5rem 0; }

@media (max-width: 575.98px) {
    .darkomat-promo { flex-wrap: wrap; }
    .darkomat-promo-actions { width: 100%; }
    .darkomat-promo-actions .btn { flex: 1 1 auto; }
}

html[data-theme="dark"] .darkomat-promo { color: var(--dark-text); }
