/* Everyday French — the design system: tokens and components.
 *
 * One file that every surface loads first: the theme (front end), every plugin
 * stylesheet (through ef-tokens), and wp-admin. A page — a new template, a new
 * tool, an admin screen — gets the look by using these class names; it should
 * not need any CSS of its own for colours, cards, buttons or bands.
 *
 * Light values only. The site's dark mode lives in the theme (theme.css), which
 * redefines the same tokens: wp-admin is always light, so the dark scheme must
 * not follow this file there.
 *
 * Nothing here styles a bare element except `mark`: every rule is opt-in by
 * class, so loading it in wp-admin changes nothing until a screen uses it.
 */

/* ============================ tokens ============================ */
:root {
  --fill: #2F5CE2; --fill-strong: #1F45C0; --on-fill: #ffffff;
  --accent: #2F5CE2; --head: #1A2048;
  --rust-deep: #1A2048; --on-deep: #ffffff; --gold: #E09A00;
  --ground: #FFF7E8; --surface: #ffffff; --surface-2: #FFFBF2;
  --tint: #EEF1FD; --tint-2: #DCE6FF; --tint-3: #B9CCFF;
  --ink: #1A2048; --ink-2: #3B426E; --ink-3: #5A6190;
  --line: #C9D0EE; --line-soft: #E3E7F8;
  --ink-panel: #10142E; --shadow: rgba(26,32,72,.45);
  --ok: #0F7F57; --ok-bg: #CFF1E1; --ok-bd: #169668;
  --no: #B8213F; --no-bg: #FFDCE3; --no-bd: #D6336C;
  --note-bg: #FFF4C2; --note-bd: #FFD23A; --note-ink: #5A4300;
  --bleu: #0055A4; --rouge: #EF4135;

  /* The chunky outline + hard shadow, the action yellow, and the four block
     colours used in rotation (never one per content type). White text only on
     those four and on --fill; dark text only on --sun and the pale tints. */
  --edge: #1A2048; --sun: #FFD23A; --on-sun: #1A2048;
  --pink: #D6336C; --orange: #C94A0C; --violet: #7650D4; --green: #0F7F57;
  --outline: 3px solid var(--edge);
  --pop-sm: 3px 3px 0 var(--edge); --pop: 4px 4px 0 var(--edge); --pop-md: 5px 5px 0 var(--edge);
  --pop-lg: 6px 6px 0 var(--edge); --pop-xl: 8px 8px 0 var(--edge);
  --r-sm: 14px; --r: 22px; --r-lg: 26px;

  /* CEFR levels: one blue ramp, darker = harder. A0–A1 take dark text, the rest white. */
  --lvl-A0: #EEF2FF; --lvl-A1: #DCE6FF; --lvl-A2: #5B7FEA; --lvl-B1: #2F5CE2; --lvl-B2: #2440B0; --lvl-C1: #1A2048;

  --serif: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --sans: var(--serif);
  --maxw: 1180px;
}

/* ============================ band ============================
   The blue band a page opens with: the title, a line under it, sometimes
   pills. `--bleed` breaks it out of a centred column to the full width. */
.ef-band { background: var(--fill); color: #fff; border-bottom: var(--outline); padding-block: 44px; }
.ef-band--center { text-align: center; }
.ef-band--bleed { margin-inline: calc(50% - 50vw); padding-inline: max(2rem, calc(50vw - 50%)); margin-bottom: 2rem; }
/* The top half of a band that continues below (the Pronunciation sub-nav). */
.ef-band--open { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.ef-band--open + .ef-band, .ef-band--open + * > .ef-band:first-child { padding-top: 1.6rem; }
.ef-band .ef-band__title { font-family: var(--serif); font-weight: 900; font-size: clamp(38px, 6.5vw, 68px); line-height: 1.02; letter-spacing: -.03em; color: #fff; margin: 0 0 .75rem; }
.ef-band .ef-band__lede { color: #fff; font-size: 18px; font-weight: 600; line-height: 1.5; max-width: 54ch; margin: 0 auto; }
.ef-band__pills { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.1rem; }

/* ============================ card ============================ */
.ef-card { background: var(--surface); color: var(--ink); border: var(--outline); border-radius: var(--r); box-shadow: var(--pop-md); }
.ef-card--lg { border-radius: var(--r-lg); box-shadow: var(--pop-xl); }
.ef-card--sm { border-width: 2px; border-radius: var(--r-sm); box-shadow: var(--pop-sm); }
/* A whole card that is a link or a button. */
a.ef-card, button.ef-card { display: block; text-decoration: none; text-align: left; font: inherit; cursor: pointer; }

/* ============================ buttons ============================
   Yellow = the action. Outlined, on a hard shadow, they press down. */
.ef-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none; cursor: pointer;
  font-family: var(--sans); font-weight: 900; font-size: 1.02rem; line-height: 1.2;
  background: var(--sun); color: var(--on-sun); border: var(--outline); border-radius: 999px;
  padding: .8rem 1.5rem; box-shadow: var(--pop);
}
.ef-btn:hover { background: var(--sun); color: var(--on-sun); }
.ef-btn:disabled, .ef-btn[disabled] { opacity: .55; cursor: default; }
.ef-btn--ghost, .ef-btn--ghost:hover { background: var(--surface); color: var(--ink); }
.ef-btn--sm { padding: .45rem 1rem; font-size: .9rem; box-shadow: var(--pop-sm); }
.ef-btn--block { display: flex; width: 100%; }

/* "Back to the list" — a small white pill. */
.ef-back {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 1.2rem; cursor: pointer;
  font: inherit; font-size: .9rem; font-weight: 800; line-height: 1.2; color: var(--ink); text-decoration: none;
  padding: .4rem .9rem .4rem .7rem; border-radius: 999px; background: var(--surface); border: 2px solid var(--edge); box-shadow: var(--pop-sm);
}
.ef-back:hover { color: var(--ink); }

/* ============================ chips ============================ */
.ef-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--surface); color: var(--ink); border: 2px solid var(--edge); border-radius: 999px; padding: .3rem .85rem; font-size: .84rem; font-weight: 800; line-height: 1.3; }
button.ef-chip { font-family: inherit; cursor: pointer; }
.ef-chip.is-on, button.ef-chip.is-on:hover { background: var(--fill); color: #fff; box-shadow: 2px 2px 0 var(--edge); }
.ef-chip--sun { background: var(--sun); color: var(--on-sun); }

/* CEFR level colours, on any chip, tile or badge. */
.ef-lvl--A0 { background: var(--lvl-A0); color: var(--ink); }
.ef-lvl--A1 { background: var(--lvl-A1); color: var(--ink); }
.ef-lvl--A2 { background: var(--lvl-A2); color: #fff; }
.ef-lvl--B1 { background: var(--lvl-B1); color: #fff; }
.ef-lvl--B2 { background: var(--lvl-B2); color: #fff; }
.ef-lvl--C1 { background: var(--lvl-C1); color: #fff; }

/* ============================ colour rotation ============================
   Put .ef-rot on a list; each child reads its block colour from --rot. */
.ef-rot > :nth-child(4n+1) { --rot: var(--pink); }
.ef-rot > :nth-child(4n+2) { --rot: var(--violet); }
.ef-rot > :nth-child(4n+3) { --rot: var(--green); }
.ef-rot > :nth-child(4n+4) { --rot: var(--orange); }
/* A coloured block: white text on the rotation colour. */
.ef-tile { background: var(--rot, var(--pink)); color: #fff; border: var(--outline); border-radius: 18px; box-shadow: var(--pop); }
a.ef-tile, button.ef-tile { text-decoration: none; font: inherit; cursor: pointer; }
.ef-tile:hover { background: var(--rot, var(--pink)); color: #fff; }

/* ============================ press ============================
   Anything clickable that stands on a hard shadow lifts on hover and presses
   into its shadow when tapped. Built into .ef-btn, .ef-back, clickable cards
   and tiles; add .ef-press to anything else. */
:is(.ef-press, .ef-btn, .ef-back, a.ef-card, button.ef-card, a.ef-tile, button.ef-tile, button.ef-chip) { transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; }
:is(.ef-press, .ef-btn, .ef-back, a.ef-card, button.ef-card, a.ef-tile, button.ef-tile):hover:not(:disabled) { transform: translate(-2px, -2px); }
:is(.ef-press, .ef-btn, .ef-back, a.ef-card, button.ef-card, a.ef-tile, button.ef-tile, button.ef-chip):active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--edge); transition-duration: .05s; }
@media (prefers-reduced-motion: reduce) {
  :is(.ef-press, .ef-btn, .ef-back, a.ef-card, button.ef-card, a.ef-tile, button.ef-tile, button.ef-chip) { transition: none; }
}

/* ============================ ready-made sets ============================
   The opening of the trainers (Flashcards, Verbs): four big coloured cards,
   then the full picker folded away until asked for (ef-presets.js). */
.ef-presets-h { font-family: var(--serif); font-size: clamp(28px, 4vw, 38px); font-weight: 900; letter-spacing: -.025em; color: var(--ink); margin: 0 0 20px; }
.ef-presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 0 0 40px; }
.ef-preset { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center; text-align: left; padding: 20px 20px 18px; border-radius: var(--r); box-shadow: var(--pop-md); }
.ef-preset-icon { grid-row: 1 / span 2; width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; background: #fff; border: var(--outline); border-radius: 50%; }
.ef-preset-title { font-family: var(--serif); font-size: 24px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; color: #fff; }
.ef-preset-sub { font-size: 14px; font-weight: 700; color: #fff; opacity: .92; }
.ef-preset-go { grid-column: 1 / -1; justify-self: start; margin-top: 14px; background: var(--sun); color: var(--on-sun); border: var(--outline); border-radius: 999px; padding: 7px 18px; font-size: 15px; font-weight: 900; box-shadow: var(--pop-sm); }
@media (max-width: 560px) { .ef-presets { grid-template-columns: 1fr; gap: 16px; } }

.ef-custom > summary { list-style: none; cursor: pointer; padding: 18px 60px 18px 22px; position: relative; display: flex; flex-direction: column; gap: 2px; }
.ef-custom > summary::-webkit-details-marker { display: none; }
.ef-custom-title { font-family: var(--serif); font-size: 21px; font-weight: 900; color: var(--ink); }
.ef-custom-lede { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ef-custom-body { padding: 20px 22px 22px; border-top: var(--outline); }

/* The yellow "+" that turns into "×" on an open <details>. */
.ef-plus { position: relative; }
.ef-plus > summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; margin-top: -16px; width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--sun); color: var(--on-sun); border: 2px solid var(--edge); border-radius: 50%; font-weight: 900; font-size: 20px; line-height: 1;
  transition: transform .2s;
}
.ef-plus[open] > summary::after { transform: rotate(45deg); }

/* ============================ highlight ============================
   ONE style for a marked letter or word, everywhere a reader meets one. */
mark { background: var(--sun); color: var(--on-sun); border-radius: 4px; padding: 0 .12em; font-weight: 900; }

/* ============================ image zoom ============================
   A picture that zooms inside its own viewport (ef-zoom.js), so what is next to
   it stays usable. The icon buttons sit in a bar above it, never over it. */
.ef-zoom { display: flex; flex-direction: column; gap: 6px; width: fit-content; max-width: 100%; margin: 0 auto; }
.ef-zoom__tools { display: flex; justify-content: flex-end; gap: 6px; }
.ef-zoom__view { position: relative; overflow: hidden; border-radius: 12px; background: var(--tint); touch-action: pan-y; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.ef-zoom__view.is-zoomed { touch-action: none; cursor: grab; }
.ef-zoom__img { display: block; transform-origin: 0 0; max-width: 100%; will-change: transform; -webkit-user-drag: none; }
.ef-content .wp-block-image img, .ef-single__media img, .nb-img, .ef-zoomable { cursor: zoom-in; }
.ef-zoom__btn {
  appearance: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: var(--surface); color: var(--ink); border: 2px solid var(--edge); border-radius: 10px;
  cursor: pointer; box-shadow: 0 2px 0 var(--edge);
}
.ef-zoom__btn:hover:not(:disabled) { background: var(--sun); }
.ef-zoom__btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.ef-zoom__btn[hidden] { display: none; }
.ef-zoom__btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.ef-zoom-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(10, 14, 40, .94); overscroll-behavior: contain; }
.ef-zoom-dialog::backdrop { background: rgba(10, 14, 40, .94); }
.ef-zoom--full { width: 100%; height: 100%; max-width: none; margin: 0; padding: 12px; box-sizing: border-box; }
.ef-zoom--full .ef-zoom__view { flex: 1; min-height: 0; background: transparent; touch-action: none; }
.ef-zoom--full .ef-zoom__img { width: 100%; height: 100%; object-fit: contain; }

/* ============================ exam clock ============================
   The countdown of a timed exercise or test (ef-exam.js). */
.ef-exam__clock { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .7rem; font-weight: 900; font-size: .95rem; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface); border: 2px solid var(--edge); border-radius: 999px; }
.ef-exam__clock svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ef-exam__clock.is-low { background: var(--sun); color: var(--on-sun); }
.ef-exam__clock.is-over { background: var(--no); color: #fff; }
.ef-exam__toast { position: fixed; z-index: 100000; left: 50%; top: 16px; transform: translateX(-50%); max-width: min(92vw, 560px); padding: .8rem 1.2rem; font-weight: 800; color: #fff; background: var(--no); border: var(--outline); border-radius: var(--r-sm); box-shadow: var(--pop); }
.ef-exam__note { margin: 0 0 1rem; padding: .6rem 1rem; font-weight: 800; color: var(--ink); background: var(--note-bg); border: 2px solid var(--note-bd); border-radius: var(--r-sm); }
