/*
    Theme Name: Dětská univerzita
    Theme URI: https://detskauniverzita.tul.cz/
    Description: Veřejná prezentace Dětské univerzity TUL. Data o kurzech a přihlášky obstarává systém DUis přes API.
    Author: Jan Ráček
    Author URI: https://honzuvkod.dev/
    Version: 2.3.0
    Text Domain: duweb
*/

/* ─────────────────────────────────────────────────────────────────────────────
   Fonts
   ───────────────────────────────────────────────────────────────────────────*/

/* Inter is enqueued from inc/include-css.php, not @import-ed here.
   An @import inside a stylesheet is discovered only after this file has been
   downloaded and parsed, so the font request is serialised behind it — two
   round trips before any text can be painted in its real face. A <link> in the
   head, with preconnect, starts both at once. */

@font-face {
    font-family: 'TULMonoRegular';
    src: url('./assets/fonts/TULMono/TULMono-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Design tokens
   The brand color (--brand) can be overridden live from the WordPress
   Customizer — functions.php prints a :root override in <head>. Everything
   below references the tokens, so re-coloring the whole site needs no code.
   ───────────────────────────────────────────────────────────────────────────*/

:root {
    --brand:        #5948AD;
    --brand-600:    #4e3f9c;
    --brand-700:    #423584;
    --brand-300:    #8b7ad6;
    --brand-100:    #ece9fb;
    --brand-050:    #f6f4fd;

    --accent:       #ff8a3d;   /* warm highlight — playful, "kids" energy   */
    --accent-600:   #f2741f;

    --ok:           #16a34a;
    --warn:         #f59e0b;
    --danger:       #ef4444;

    --ink:          #1d1a2e;
    --muted:        #6b6680;
    --line:         #e8e5f1;
    --surface:      #ffffff;
    --bg:           #f7f6fc;

    --r-sm: 10px;
    --r:    16px;
    --r-lg: 24px;
    --pill: 999px;

    --shadow-sm: 0 1px 2px rgba(29,26,46,.06), 0 2px 6px rgba(29,26,46,.06);
    --shadow:    0 6px 18px -6px rgba(29,26,46,.18), 0 12px 40px -12px rgba(29,26,46,.18);
    --shadow-lg: 0 18px 50px -12px rgba(89,72,173,.35);

    --container: 1200px;
    --ease: cubic-bezier(.22, 1, .36, 1);

    --font-head: "TULMonoRegular", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --brand-gradient: linear-gradient(135deg, #6f5cd6 0%, var(--brand) 55%, var(--brand-700) 100%);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Base / resets
   ───────────────────────────────────────────────────────────────────────────*/

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

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

/* Nothing embedded may be wider than the column holding it. */
img, svg, video, canvas, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Flex and grid children default to `min-width: auto`, which means "never
   smaller than my content" — one long word or one wide image then pushes the
   whole row past the viewport. This is the single most common cause of a page
   that scrolls sideways on a phone, and it is cheaper to disarm everywhere than
   to chase one container at a time. */
main, section, article, aside, header, footer, nav, div, figure, form, p, li {
    min-width: 0;
}

/* Czech compounds are long: "volnočasových", "Programování". At phone widths a
   single unbroken word can be wider than the screen. */
h1, h2, h3, h4, h5, h6, p, li, dd, dt, figcaption, a, td, th, label, legend {
    overflow-wrap: break-word;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* A backstop, not a fix: it hides a sideways scrollbar without removing
       whatever caused it, and on iOS it does not reliably stop panning either.
       Anything that overflows is still a bug to find. */
    overflow-x: hidden;
    /* Sticky footer: fill the viewport so short pages don't leave a white strip
       below the footer. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* #main-content wraps the page <main> and the <footer>; let it absorb the
   remaining height and push the footer to the bottom on short pages. */
#main-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
#main-content > main {
    flex: 1 0 auto;
}

p { font-family: var(--font-body); color: var(--ink); }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--brand);
    line-height: 1.15;
    letter-spacing: -.01em;
}

h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

a { color: var(--brand-600); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--brand-700); }

img { max-width: 100%; height: auto; }

::selection { background: var(--brand-300); color: #fff; }

:focus-visible {
    outline: 3px solid var(--brand-300);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    background: var(--brand);
    color: #fff;
    padding: .75rem 1.25rem;
    border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ─────────────────────────────────────────────────────────────────────────────
   Utilities
   ───────────────────────────────────────────────────────────────────────────*/

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }

.vertical-align { display: flex; flex-direction: column; justify-content: center; }

.darkener {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(29,26,46,.30) 0%, rgba(29,26,46,.62) 100%);
}

.button {
    --btn-bg: var(--brand-gradient);
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background-image: var(--btn-bg);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 600;
    padding: .95rem 2rem;
    border: none;
    border-radius: var(--pill);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}
.button:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lg); filter: saturate(1.08); }
.button:active { transform: translateY(0); }

.button-ghost {
    background: transparent;
    background-image: none;
    color: var(--brand);
    border: 2px solid var(--brand);
    box-shadow: none;
}
.button-ghost:hover { background: var(--brand); color: #fff; }

#filter {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(circle, rgba(0,0,0,.55) 40%, rgba(0,0,0,0) 100%);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Header
   ───────────────────────────────────────────────────────────────────────────*/

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: .85rem clamp(1rem, 4vw, 3rem);
    background: rgba(89, 72, 173, .92);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    box-shadow: 0 8px 30px -12px rgba(29,26,46,.55);
}

/* The logo file is 3075 x 266. `width: auto` with only `max-height` set leaves
   the width to the aspect ratio, which at 56px tall is 648px — wider than any
   phone, and as a flex item with `min-width: auto` it refused to shrink. That
   was the horizontal scroll on the front page: `overflow-x: hidden` on <body>
   hid the scrollbar without removing the overflow. Constrain the width too. */
header .custom-logo-link {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 0 1 auto;
}
header .custom-logo,
header .custom-logo-link img {
    display: block;
    width: auto;
    height: auto;
    max-height: clamp(32px, 7vw, 56px);
    max-width: min(58vw, 380px);
    object-fit: contain;
    padding-left: .25rem;
}

header nav ul {
    display: flex;
    align-items: center;
    gap: .35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

header nav ul li { font-family: var(--font-head); white-space: nowrap; }

header nav ul li a {
    color: rgba(255,255,255,.92);
    text-decoration: none;
    padding: .5rem .95rem;
    border-radius: var(--pill);
    transition: background .2s var(--ease), color .2s var(--ease);
}
header nav ul li a:hover,
header nav ul li.current-menu-item a {
    color: #fff;
    background: rgba(255,255,255,.16);
}

/* Mobile nav toggle (progressive enhancement) */
.nav-toggle {
    display: none;
    background: rgba(255,255,255,.14);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    padding: .55rem .7rem;
    font-size: 1.25rem;
    cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Front page — hero
   ───────────────────────────────────────────────────────────────────────────*/

#welcome-banner {
    position: relative;
    width: 100%;
    min-height: clamp(440px, 78vh, 760px);
    display: grid;
    place-items: center;
    background-position: center;
    background-size: cover;
    isolation: isolate;
}
#welcome-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 9;
    background: linear-gradient(180deg, rgba(29,26,46,.25), rgba(66,53,132,.65));
}

#welcome-banner .text {
    position: relative;
    z-index: 11;
    text-align: center;
    max-width: 760px;
    padding: clamp(2rem, 5vw, 3.5rem);
    margin: 1.5rem;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    animation: rise .8s var(--ease) both;
}
#welcome-banner .text h1 { color: var(--brand); margin: 0 0 1.75rem; }
#welcome-banner .text p { color: var(--muted); font-size: 1.1rem; margin: 0 0 1.75rem; }

@keyframes rise {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Text banners */
.text-banner {
    text-align: center;
    max-width: 820px;
    margin-inline: auto;
    padding: clamp(3.5rem, 8vw, 6rem) 1.5rem;
}
.text-banner h2 { margin: 0 0 1rem; }
.text-banner p { color: var(--muted); font-size: 1.12rem; margin: 0 auto 1.5rem; max-width: 64ch; }

/* Section eyebrow + heading accent */
.text-banner h2::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin: 1rem auto 0;
    border-radius: var(--pill);
    background: var(--brand-gradient);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Front page — feature blocks ("tantalizers")
   ───────────────────────────────────────────────────────────────────────────*/

#tantalizers {
    position: relative;
    background-position: center;
    background-size: cover;
    padding: clamp(3rem, 7vw, 6rem) 0;
    isolation: isolate;
}
#tantalizers::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(247,246,252,.86), rgba(247,246,252,.94));
}

.tantalizer {
    display: flex;
    width: min(100% - 2.5rem, 1040px);
    margin: 2rem auto;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 11;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.tantalizer:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.tantalizer .wrapper {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tantalizer .wrapper .text { padding: clamp(1.5rem, 4vw, 3rem); width: 88%; margin: auto; }
.tantalizer .wrapper .text h2 { margin-top: 0; }
.tantalizer .wrapper .text p { color: var(--muted); margin-bottom: 0; }

.tantalizer .img {
    width: 50%;
    min-height: 340px;
    background-position: center;
    background-size: cover;
}

.tantalizer-left { background: var(--surface); }
.tantalizer-right { background: var(--brand-gradient); }
.tantalizer-right h2, .tantalizer-right p { color: #fff !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   Generic page
   ───────────────────────────────────────────────────────────────────────────*/

main { padding: clamp(2.5rem, 6vw, 5rem) 0; }
main.container { width: min(100% - 2.5rem, var(--container)); }
main h1 { color: var(--brand); }

.page-hero {
    text-align: center;
    padding: 2rem 0 1rem;
}
.page-hero hr,
main hr {
    border: none;
    height: 1px;
    background: var(--line);
    margin: 1.5rem 0 2.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Courses grid
   ───────────────────────────────────────────────────────────────────────────*/

#courses-view { margin: 2.5rem 0; }

/* ── Group heading ──────────────────────────────────────────────────────────
   The category a set of variants share. Deriving it is in register-courses.php;
   the rule here is only that it must read as a section, not as another card. */
.course-group { margin-bottom: clamp(2.5rem, 5vw, 4rem); }

.course-group-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .5rem .9rem;
    margin: 0 0 1.5rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--line);
}
.course-group-head h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: .85rem;
    flex: 1 1 auto;
}
.course-group-head h2::before {
    content: "";
    flex: none;
    width: 6px;
    height: 1.15em;
    border-radius: var(--pill);
    background: var(--brand-gradient);
}
.course-group-count {
    flex: none;
    font-family: var(--font-head);
    font-size: .85rem;
    letter-spacing: .02em;
    color: var(--muted);
    background: var(--brand-050);
    border: 1px solid var(--brand-100);
    border-radius: var(--pill);
    padding: .2rem .8rem;
}

/* ── The grid ───────────────────────────────────────────────────────────────*/
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(1rem, 2vw, 1.75rem);
    align-items: start;
}

/* ── A course card ──────────────────────────────────────────────────────────
   Was a photo with white text laid over it. Course names here run to seventy
   characters of Czech, and set over a photograph at four lines they were hard
   to read and impossible to keep contrast-safe across every uploaded image.
   The photograph is now a header and the words sit on a solid panel, which also
   leaves room to say the thing a parent actually wants to know: how many places
   are left. */
.course {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease),
                border-color .35s var(--ease);
    isolation: isolate;
}
.course:hover,
.course:focus-visible {
    transform: translateY(-6px);
    border-color: var(--brand-100);
    box-shadow: var(--shadow-lg);
}
.course:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

.course-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--brand-100);
    overflow: hidden;
}
/* No photograph of its own: a branded panel with the course code, never a
   photograph of some other course. */
.course-media-blank {
    display: grid;
    place-items: center;
    background: var(--brand-gradient);
}
.course-code {
    font-family: var(--font-head);
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    letter-spacing: .06em;
    color: #fff;
    opacity: .92;
    text-align: center;
    padding: 0 1rem;
}
/* The wash exists to even out photographs; over the flat panel it only muddies
   the code. */
.course-media-blank::after { display: none; }

.course-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1.1s var(--ease);
}
.course:hover .course-media img { transform: scale(1.06); }
/* A wash of brand colour over every photograph, so a grid of pictures taken by
   different people on different days still reads as one page. */
.course-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(89,72,173,.10) 0%, rgba(29,26,46,.42) 100%);
}

.course-body {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    padding: 1.15rem 1.25rem 1.25rem;
    flex: 1 0 auto;
}

.course-name {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.3;
    color: var(--brand);
    /* Three lines is enough to tell two variants apart; past that the card
       stops being scannable. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-excerpt {
    margin: 0;
    font-size: .9rem;
    line-height: 1.55;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-meta {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-size: .88rem;
    color: var(--muted);
    min-width: 0;
}
.course-meta i { color: var(--brand-300); width: 1rem; text-align: center; flex: none; }
.course-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Capacity ───────────────────────────────────────────────────────────────
   A bar and the same number in words. "Poslední místa" alone never said whether
   that meant one place or three. */
.course-capacity { display: flex; align-items: center; gap: .7rem; }

.capacity-bar {
    flex: 1 1 auto;
    height: 6px;
    border-radius: var(--pill);
    background: var(--brand-100);
    overflow: hidden;
}
.capacity-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ok);
    transition: width .6s var(--ease);
}
.course-almost .capacity-bar > span { background: var(--warn); }
.course-full   .capacity-bar > span { background: var(--danger); }

.capacity-text {
    flex: none;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
}

.course-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: auto;
    padding-top: .85rem;
    border-top: 1px solid var(--line);
}
.course-price {
    font-family: var(--font-head);
    font-size: 1.15rem;
    color: var(--ink);
    white-space: nowrap;
}
.course-more {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
}
.course-more i { transition: transform .3s var(--ease); }
.course:hover .course-more i { transform: translateX(4px); }

/* A full course is still worth reading about — dimmed, not hidden. */
.course-full .course-media img { filter: grayscale(.55); }

/* ── Status badges ──────────────────────────────────────────────────────────*/
.badge,
.badge-free, .badge-almost, .badge-full, .badge-soon, .badge-followup {
    display: inline-block;
    padding: .3rem .85rem;
    border-radius: var(--pill);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: #fff;
    line-height: 1.5;
}
/* On a card the badge sits on the photo; elsewhere it is inline. */
.course-media .badge {
    position: absolute;
    z-index: 1;
    top: .8rem;
    right: .8rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(20,16,40,.35);
    max-width: calc(100% - 1.6rem);
}
.badge-free     { background: var(--ok); }
.badge-almost   { background: var(--warn); color: #3b2a00; }
.badge-full     { background: var(--danger); }
.badge-soon     { background: #b3261e; }
.badge-followup { background: var(--brand); }

/* ── "Enrolment is not open" banner ─────────────────────────────────────────
   Lived as a <style> block inside the shortcode; here so there is one place
   that decides how the grid looks. */
.duweb-enroll-banner {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    margin: 0 0 2rem;
    padding: 1.15rem 1.4rem;
    border-radius: var(--r);
    border: 2px solid #b3261e;
    background: #fdeceb;
    color: #7f1d1a;
}
.duweb-enroll-banner i { font-size: 1.5rem; line-height: 1.35; flex: none; }
.duweb-enroll-banner strong { display: block; font-size: 1.2rem; line-height: 1.35; }
.duweb-enroll-banner span { display: block; margin-top: .3rem; font-size: .95rem; opacity: .85; }

/* Legacy class hooks kept for safety */
.course-disabled { filter: grayscale(1); }

/* ─────────────────────────────────────────────────────────────────────────────
   Single course header (used by single template / shortcode fallback)
   ───────────────────────────────────────────────────────────────────────────*/

#course-header {
    position: relative;
    width: 100%;
    /* Painted, not blank: with no course photograph there is no background
       image, and an unstyled band reads as a failed load. */
    background-color: var(--brand);
    background-image: var(--brand-gradient);
    min-height: 360px;
    margin: auto;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    border-radius: var(--r-lg);
    background-position: center;
    background-size: cover;
}
#course-header #filter {
    background: linear-gradient(0deg, rgba(20,16,40,.85) 0%, rgba(20,16,40,.30) 60%, transparent 100%);
}
#course-header .text {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: left;
}
#course-header .text * { color: #fff; }
#course-header .text h1 { color: #fff; margin: 0 0 .75rem; }
#course-header .text span {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-right: 1.5rem;
    font-size: 1.05rem;
    opacity: .95;
}

.apply,
#course-header .text .apply {
    display: inline-block;
    margin-top: 1.25rem;
    padding: .8rem 2rem;
    border-radius: var(--pill);
    background: var(--ok);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}
.apply:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lg); filter: brightness(1.05); }
.apply.almost-button { background: var(--warn); color: #3b2a00; }
.apply.full-button,
#course-header .text .full-button { background: var(--danger); cursor: default; }
.apply.full-button:hover { transform: none; filter: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   Náš tým

   One person per row, not a grid of cards.

   The biographies are 457, 342, 245, 222 and 195 characters long and four
   people have none at all — and the empty ones sit at positions 1, 3, 7 and 8,
   so they interleave. In a 260px column that is a thirteen-line card beside an
   empty one in the very first row, and no alignment setting fixes it: `stretch`
   leaves a hole, `start` leaves a ragged edge.

   Side by side is the problem, so nothing is side by side. A row has no
   neighbour to be uneven against, and a full-width measure cuts the longest
   biography from about thirteen lines to about four — the difference between
   "these cards are broken" and "these paragraphs are different lengths", which
   is what every page of prose looks like anyway.
   ───────────────────────────────────────────────────────────────────────────*/

.duweb-team-intro {
    max-width: 68ch;
    margin: 0 0 2.5rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.duweb-team {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 62rem;
    margin: 2.5rem 0 1rem;
}

.duweb-person {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: clamp(1.1rem, 3vw, 2rem);
    padding: clamp(1.25rem, 3vw, 1.9rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease),
                border-color .3s var(--ease);
}

/* A brand rule down the leading edge — the thing that keeps a stack of rows
   reading as a designed roster rather than as a table. */
.duweb-person::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand-gradient);
    opacity: .35;
    transition: opacity .3s var(--ease);
}
.duweb-person:hover {
    transform: translateX(3px);
    border-color: var(--brand-100);
    box-shadow: var(--shadow);
}
.duweb-person:hover::before { opacity: 1; }

.duweb-person-figure { flex: none; }

.duweb-person-photo {
    display: block;
    width: clamp(76px, 13vw, 116px);
    aspect-ratio: 1;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    background: var(--brand-100);
    border: 3px solid var(--surface);
    box-shadow: 0 6px 20px -8px rgba(29,26,46,.5);
}

/* No photograph: this person's initials on the brand gradient. */
.duweb-person-monogram {
    display: grid;
    place-items: center;
    background: var(--brand-gradient);
    color: #fff;
    font-family: var(--font-head);
    font-size: clamp(1.6rem, 4.5vw, 2.3rem);
    line-height: 1;
    letter-spacing: .02em;
}

.duweb-person-body { min-width: 0; }

.duweb-person-name {
    margin: 0;
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
    line-height: 1.25;
    color: var(--brand);
}

.duweb-person-role {
    display: inline-block;
    margin: .5rem 0 0;
    padding: .2rem .85rem;
    border-radius: var(--pill);
    background: var(--brand-050);
    border: 1px solid var(--brand-100);
    color: var(--brand-700);
    font-family: var(--font-head);
    font-size: .78rem;
    letter-spacing: .02em;
}

.duweb-person-bio {
    /* Capped by characters, not pixels: a line much longer than this is hard to
       track back to the start of, however wide the screen gets. */
    max-width: 62ch;
    margin: .9rem 0 0;
    font-size: .96rem;
    line-height: 1.65;
    color: var(--muted);
}

/* Nothing special to do for someone with no biography — the row is simply
   shorter, and with no card beside it there is nothing for that to look wrong
   against. The class stays as a hook. */
.duweb-person.is-brief { }

@media (max-width: 520px) {
    /* Portrait on its own line so the text gets the full width. Beside a photo
       at this size the column is about thirty-five characters, and a 450-
       character biography becomes thirteen lines of ladder. */
    .duweb-person {
        grid-template-columns: 1fr;
        gap: .9rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────────────────────*/

footer {
    background: var(--brand-gradient);
    color: rgba(255,255,255,.92);
    padding: clamp(2.5rem, 6vw, 4rem) 0 2rem;
}
.footer-inner {
    width: min(100% - 2.5rem, var(--container));
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}
.footer-brand img { width: 220px; max-width: 100%; margin-bottom: 1rem; }
.footer-brand p { color: rgba(255,255,255,.85); max-width: 38ch; }

.footer-col h4 { color: #fff; margin: 0 0 1rem; font-size: 1.05rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col ul li { margin-bottom: .55rem; }
.footer-col ul li a,
.footer-col p a { color: rgba(255,255,255,.88); }
.footer-col ul li a:hover,
.footer-col p a:hover { color: #fff; text-decoration: underline; }
.footer-contact p { display: flex; align-items: flex-start; gap: .65rem; margin: 0 0 .6rem; color: rgba(255,255,255,.88); }
.footer-contact i { margin-top: .25rem; }

.footer-social { display: flex; gap: .65rem; margin-top: 1rem; }
.footer-social a {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: var(--pill);
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 1.05rem;
    transition: background .2s var(--ease), transform .2s var(--ease);
}
.footer-social a:hover { background: rgba(255,255,255,.28); transform: translateY(-2px); color: #fff; }

.footer-bottom {
    width: min(100% - 2.5rem, var(--container));
    margin: 2.5rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,.18);
    font-size: .88rem;
    color: rgba(255,255,255,.7);
    text-align: center;
}

/* Fallback footer menu styling (when no widget-style columns used) */
footer .menu-zapati-container ul { list-style: none; margin: 0; padding: 0; }
footer .menu-zapati-container ul li a { color: rgba(255,255,255,.88); }

/* ─────────────────────────────────────────────────────────────────────────────
   Forms
   ───────────────────────────────────────────────────────────────────────────*/

form { margin-top: 2.5rem; max-width: 760px; }

form h1, form h3 { margin-top: 2.5rem; }
form h1 { font-size: 1.4rem; }
form > label, form p { color: var(--ink); }

form label { font-weight: 500; }

form input[type=text], form input[type=email], form input[type=tel],
form input[type=time], form input[type=number], form select, form textarea {
    width: 100%;
    padding: .85rem 1rem;
    margin: .4rem 0 0;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-sm);
    box-sizing: border-box;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
form input:focus, form select:focus, form textarea:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 4px var(--brand-100);
}

form input, form select, form textarea, form .g-recaptcha { margin-bottom: 1.5rem !important; }

form input[type="submit"] {
    background-image: var(--brand-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    padding: .9rem 2.25rem;
    border: none;
    border-radius: var(--pill);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
form input[type="submit"]:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
form input[type="submit"]:disabled { opacity: .7; cursor: progress; transform: none; }

.form-error { color: var(--danger); font-size: .9rem; font-weight: 600; }

/* Custom checkbox */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 38px;
    margin-bottom: 1rem;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1.5;
    user-select: none;
}
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 26px;
    width: 26px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.checkbox-container:hover input ~ .checkmark { border-color: var(--brand-300); }
.checkbox-container input:checked ~ .checkmark { background: var(--brand); border-color: var(--brand); }
.checkmark:after { content: ""; position: absolute; display: none; }
.checkbox-container input:checked ~ .checkmark:after { display: block; }
.checkbox-container .checkmark:after {
    left: 9px; top: 4px;
    width: 6px; height: 12px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Enrollment form (apply-courses.php)
   The public form is the one page every parent has to get through, so it uses
   the same card language as the rest of the site instead of the bare
   label/<br> stack it used to be.
   ───────────────────────────────────────────────────────────────────────────*/

.apply-page { width: min(100% - 2rem, 780px); margin-inline: auto; padding-bottom: 3rem; }

/* Course summary header */
.apply-course-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    background: var(--brand-gradient);
    color: #fff;
    border-radius: var(--r-lg);
    padding: clamp(1.25rem, 3vw, 2rem);
    margin: 2rem 0 1.5rem;
    box-shadow: var(--shadow);
}
.apply-course-card h1 { margin: .15rem 0 .75rem; color: #fff; font-size: clamp(1.4rem, 3.5vw, 2rem); }
.apply-eyebrow {
    margin: 0;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255,255,255,.78);
}
.apply-course-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .95rem;
    color: rgba(255,255,255,.92);
}
.apply-course-facts i { margin-right: .4rem; opacity: .8; }

.apply-status {
    flex-shrink: 0;
    padding: .4rem 1rem;
    border-radius: var(--pill);
    font-size: .85rem;
    font-weight: 700;
    background: rgba(255,255,255,.16);
    color: #fff;
}
.apply-status-free   { background: var(--ok); }
.apply-status-almost { background: var(--warn); color: #3b2a00; }
.apply-status-full   { background: var(--danger); }

/* Cards */
.apply-form { margin-top: 0; max-width: none; }

.apply-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: clamp(1.1rem, 3vw, 1.75rem);
    margin: 0 0 1.25rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;   /* <fieldset> defaults fight the card layout otherwise */
}
.apply-card legend {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0;
    margin-bottom: .35rem;
    font-family: var(--font-head);
    font-size: 1.15rem;
    color: var(--brand);
}
.apply-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: .95rem;
    font-family: var(--font-body);
    font-weight: 700;
}

/* Field grid */
.apply-grid { display: grid; gap: 0 1rem; }
.apply-grid-2 { grid-template-columns: 1fr 1fr; }
.apply-field { min-width: 0; margin-bottom: 1.1rem; }

.apply-field label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .3rem;
}
.apply-field abbr,
.apply-card .checkbox-container abbr,
.apply-submit abbr {
    color: var(--danger);
    text-decoration: none;
    border: 0;
    margin-left: .1rem;
}

/* The global rule sets margin-bottom: 1.5rem !important on every control;
   inside these cards the grid owns the vertical rhythm. */
.apply-form input,
.apply-form select,
.apply-form textarea { margin-bottom: 0 !important; }
.apply-form textarea { resize: vertical; min-height: 5rem; }

.apply-field input[aria-invalid="true"],
.apply-field textarea[aria-invalid="true"] {
    border-color: var(--danger);
    background: #fffafa;
}
.apply-field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px #fdecec; }

.apply-field .form-error { display: block; margin-top: .35rem; }
.apply-hint { margin: .35rem 0 0; font-size: .82rem; color: var(--muted); }

/* Legal blocks */
.apply-legal {
    background: var(--brand-050);
    border: 1px solid var(--brand-100);
    border-radius: var(--r-sm);
    padding: 1rem 1.15rem;
    margin: 1.25rem 0 1rem;
}
.apply-legal h3 { margin: 0 0 .5rem; font-size: .95rem; color: var(--brand-700); }
.apply-legal p { margin: 0 0 .6rem; font-size: .88rem; line-height: 1.6; color: var(--muted); }
.apply-legal p:last-child { margin-bottom: 0; }

.apply-card .checkbox-container { font-size: .95rem; margin-bottom: .75rem; }
.apply-card .checkbox-container + .form-error { display: block; margin: -.35rem 0 .9rem 38px; }

/* Submit */
.apply-submit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .9rem;
    margin-top: 1.5rem;
}
.apply-submit .g-recaptcha { margin-bottom: 0 !important; }
.apply-submit-btn {
    background-image: var(--brand-gradient);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.05rem;
    padding: .9rem 2.5rem;
    border: none;
    border-radius: var(--pill);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.apply-submit-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.apply-submit-btn:disabled { opacity: .7; cursor: progress; transform: none; }
.apply-submit .apply-hint { margin: 0; }

/* Success screen */
.apply-result {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    width: min(100% - 2rem, 680px);
    margin: 3rem auto;
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.apply-result-ok { background: #e8f9ef; border: 1px solid #b9ebcd; color: #0f7a39; }
.apply-result i { font-size: 1.75rem; line-height: 1.2; flex-shrink: 0; }
.apply-result h2 { margin: 0 0 .5rem; font-size: 1.3rem; color: inherit; }
.apply-result p { margin: 0 0 .5rem; color: #14663a; line-height: 1.6; }
.apply-result-hint { font-size: .85rem; opacity: .8; }

/* Visually hidden, still announced. */
.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 620px) {
    .apply-grid-2 { grid-template-columns: 1fr; }
    .apply-course-card { flex-direction: column; align-items: flex-start; }
    .apply-submit-btn { width: 100%; text-align: center; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────────────────────*/

.success, .error, .info {
    display: block;
    padding: 1rem 1.25rem;
    border-radius: var(--r);
    margin: 1.25rem 0;
    font-weight: 600;
    border: 1px solid transparent;
}
.success { background: #e8f9ef; color: #0f7a39; border-color: #b9ebcd; }
.error   { background: #fdecec; color: #b42323; border-color: #f6c9c9; }
.info    { background: var(--brand-050); color: var(--brand-700); border-color: var(--brand-100); }

.shadow { box-shadow: var(--shadow); }

/* ─────────────────────────────────────────────────────────────────────────────
   Motion & accessibility preferences
   ───────────────────────────────────────────────────────────────────────────*/

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive

   Most of the layout is fluid by construction — `clamp()` for type and spacing,
   `auto-fill` grids that reflow on their own — so these are the places where a
   layout has to genuinely change rather than shrink.
   ───────────────────────────────────────────────────────────────────────────*/

/* Tablets and small laptops */
@media (max-width: 980px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}

/* Below this the header menu cannot sit on one line */
@media (max-width: 820px) {
    header { flex-wrap: wrap; gap: .75rem; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    header nav {
        flex-basis: 100%;
        display: none;
    }
    header nav.is-open { display: block; }
    header nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: .15rem;
        padding: .75rem 0 .35rem;
    }
    /* Full-width rows, and tall enough to hit with a thumb. */
    header nav ul li a {
        display: block;
        padding: .8rem 1rem;
        border-radius: var(--r-sm);
    }

    .tantalizer { display: block; }
    .tantalizer .wrapper, .tantalizer .img { width: 100%; }
    .tantalizer .img { min-height: 220px; }
    .tantalizer .wrapper .text { width: auto; }
}

/* Phones */
@media (max-width: 620px) {
    .apply-grid-2 { grid-template-columns: 1fr; }
    .apply-course-card { flex-direction: column; align-items: flex-start; }
    .apply-submit-btn { width: 100%; text-align: center; }

    .duweb-enroll-banner { padding: 1rem; }
    .duweb-enroll-banner strong { font-size: 1.05rem; }

    /* The hero panel had a fixed inset that ate most of a small screen. */
    #welcome-banner { min-height: clamp(380px, 62vh, 560px); }
    #welcome-banner .text { margin: 1rem; padding: 1.75rem 1.35rem; }

    .course-group-head { gap: .35rem .6rem; }

    /* A tap target is the whole card here, so the button-sized affordances
       inside it only need to stay legible. */
    .button { padding: .85rem 1.5rem; width: auto; }

    /* Anything that genuinely cannot fit scrolls inside itself rather than
       taking the page sideways with it. */
    table { display: block; overflow-x: auto; max-width: 100%; }
}

/* Narrow phones */
@media (max-width: 420px) {
    .courses-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; }
    .course-body { padding: 1rem 1rem 1.1rem; }
    .course-foot { flex-wrap: wrap; }
}
