/* ========================================================================
   Interview Prep — page styling on top of tokens.css + resources.css.

   An honest, self-paced practice tool: category picker → one-question-at-a-time
   flashcard with notes + reveal-able tips, a STAR explainer, a prep checklist,
   and common mistakes. NO video / recording / AI / scoring anywhere.

   Everything is scoped to `.ip-` wrappers so nothing leaks, and any form /
   input rule is OWNED here so it beats the global footer.css
   `.form-group { display:flex }` leak by both specificity and load order.
   No color-mix(). Mobile-first. Reduced-motion respected at the foot.
   ======================================================================== */

.ip-main {
    padding: 2.25rem 0 1rem;
}

/* Section rhythm — alternating subtle backgrounds for separation. */
.ip-practice-section,
.ip-checklist-section { padding: 0 0 2.75rem; }

.ip-star-section,
.ip-mistakes-section {
    padding: 2.75rem 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    margin: 2.75rem 0;
}

.ip-mistakes-section { margin-bottom: 0; }

/* The shared .r-section-head is centred + capped; left-align inside sections. */
.ip-main .r-section-head.is-left { max-width: none; }

/* ========================================================================
   Practice mode
   ======================================================================== */

/* ---------- Category picker ---------- */
.ip-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0 1.5rem;
}

.ip-cat {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-600);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.2;
}

.ip-cat:hover { border-color: var(--primary-color); color: var(--primary-color); }

.ip-cat.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(26, 137, 23, 0.25);
}

.ip-cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--gray-500);
}

.ip-cat.is-active .ip-cat-count { background: rgba(255, 255, 255, 0.22); color: var(--white); }

/* ---------- Flashcard ---------- */
.ip-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 2px hsl(220 25% 10% / 0.04), 0 12px 30px hsl(220 25% 10% / 0.08);
    padding: 1.5rem 1.5rem 1.75rem;
    overflow: hidden;
}

.ip-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ip-card-cat {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-color);
    background: var(--primary-tint);
    border: 1px solid rgba(26, 137, 23, 0.22);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
}

.ip-progress {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}

.ip-question {
    font-family: var(--font-secondary);
    font-size: clamp(1.25rem, 3.4vw, 1.6rem);
    font-weight: 600;
    line-height: 1.35;
    color: var(--gray-900);
    margin: 0 0 1.25rem;
    letter-spacing: -0.01em;
    min-height: 2.5em;
}

/* ---------- Tip (revealed) ---------- */
.ip-tip {
    background: var(--primary-tint);
    border: 1px solid rgba(26, 137, 23, 0.22);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.1rem;
    margin: 0 0 1.25rem;
    animation: fadeInUp 0.3s ease;
}

.ip-tip[hidden] { display: none; }

.ip-tip-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-dark);
    margin-bottom: 0.4rem;
}

.ip-tip-label i { color: var(--accent-yellow); }

.ip-tip-body {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--gray-700);
}

/* ---------- Notes ---------- */
.ip-notes-wrap { margin: 0 0 1.5rem; }

.ip-notes-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0 0 0.45rem;
}

.ip-notes-label i { color: var(--gray-400); }
.ip-notes-hint { font-weight: 400; color: var(--gray-400); font-size: 0.95em; }

/* Owned + scoped so footer.css .form-group flex leak can never reach it. */
.ip-notes {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 4.5rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.55;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ip-notes::placeholder { color: var(--gray-400); }
.ip-notes:hover { border-color: var(--gray-300); }
.ip-notes:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.ip-notes:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Controls ---------- */
.ip-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

/* Push primary "Next" to the right on wider cards. */
.ip-controls #ipNext { margin-left: auto; }

.ip-tip-toggle.r-btn-ghost[aria-expanded="true"] {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-tint);
}

/* ---------- Progress bar at the foot of the card ---------- */
.ip-progress-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--gray-100);
}

.ip-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.35s ease;
}

/* ========================================================================
   STAR method
   ======================================================================== */
.ip-star-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.ip-star-step {
    position: relative;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1.25rem 1.25rem;
}

.ip-star-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: var(--white);
    font-family: var(--font-secondary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 10px rgba(26, 137, 23, 0.22);
}

.ip-star-step h3 {
    font-family: var(--font-secondary);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.35rem;
}

.ip-star-step p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--gray-600);
}

.ip-star-step em { color: var(--primary-dark); font-style: normal; font-weight: 600; }

/* ---------- Worked example ---------- */
.ip-star-example {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.ip-example-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-400);
    margin-bottom: 0.75rem;
}

.ip-example-q {
    font-size: 0.9375rem;
    color: var(--gray-800);
    margin: 0 0 1rem;
    line-height: 1.55;
}

.ip-example-q strong { color: var(--gray-900); }

.ip-example-answer {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ip-example-answer li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--gray-700);
}

.ip-example-tag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-color);
    font-size: 0.8125rem;
    font-weight: 700;
    margin-top: 0.05rem;
}

/* ========================================================================
   Checklist
   ======================================================================== */
.ip-checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.ip-check-group {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.4rem;
    box-shadow: var(--shadow-sm);
}

.ip-check-group-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-secondary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.ip-check-group-title i {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.ip-check-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ip-check {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* Hide the native box; we draw our own. */
.ip-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    pointer-events: none;
}

.ip-check-box {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    margin-top: 0.1rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: transparent;
    font-size: 0.7rem;
    transition: var(--transition);
}

.ip-check:hover .ip-check-box { border-color: var(--primary-color); }

.ip-check input:focus-visible + .ip-check-box {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.ip-check.is-checked .ip-check-box {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.ip-check-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-700);
    transition: color 0.2s ease;
}

.ip-check.is-checked .ip-check-text {
    color: var(--gray-400);
    text-decoration: line-through;
}

.ip-checklist-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ip-checklist-progress {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
}

/* ========================================================================
   Common mistakes
   ======================================================================== */
.ip-mistakes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.85rem;
}

.ip-mistake {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--danger-red);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}

.ip-mistake-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--status-cancelled-bg);
    color: var(--danger-red);
    font-size: 0.9rem;
    margin-top: 0.05rem;
}

.ip-mistake-text {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--gray-700);
}

/* ========================================================================
   Responsive
   ======================================================================== */
@media (max-width: 560px) {
    .ip-main { padding: 1.75rem 0 0.5rem; }

    .ip-card { padding: 1.25rem 1.1rem 1.5rem; border-radius: var(--radius-lg); }

    /* Stack controls into a tidy 2-up grid on small screens. */
    .ip-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .ip-controls .r-btn { width: 100%; }
    .ip-controls #ipNext { margin-left: 0; }
    /* Tip toggle spans full width above the nav buttons. */
    .ip-tip-toggle { grid-column: 1 / -1; order: -1; }
    #ipShuffle { grid-column: 1 / -1; }

    .ip-star-example,
    .ip-check-group { padding: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ip-cat,
    .ip-check-box,
    .ip-check-text,
    .ip-notes,
    .ip-progress-fill,
    .more-resource-card { transition: none; }
    .ip-tip { animation: none; }
}
