/*
 * Public exam countdown pages (ExamCountdownController, templates/exam/*).
 *
 * Self-contained, unlike every other stylesheet here. The rest of the app gets its tokens from
 * css/theme.css, which MyThemeApplier loads into the Vaadin shell — and these pages have no Vaadin
 * shell. So the handful of brand values are restated below rather than inherited. They are copied
 * from theme.css and must be changed with it; the alternative, loading the whole Lumo token set
 * into a page that uses six of it, would cost every search visitor a stylesheet they cannot see.
 *
 * These pages are LIGHT ONLY, by decision. The rest of the app follows the reader's theme, but
 * this is a landing surface reached from a search result: it is the first impression, it is what
 * gets screenshotted and shared, and one predictable appearance is worth more here than matching
 * a system setting. Do not reintroduce a prefers-color-scheme block - every colour below is a
 * fixed value, and a half-applied dark override would leave dark text on a dark ground.
 */

:root {
  --ex-teal-50:  #eaf6f6;
  --ex-teal-100: #d2ecec;
  --ex-teal-400: #5ec8c4;
  --ex-teal-500: #3fa7a3;
  --ex-teal-600: #2b8783;
  --ex-teal-700: #1f6663;

  --ex-plum-500: #5c2f6b;
  --ex-plum-600: #46224f;

  --ex-hero-start: #0f1330;
  --ex-hero-mid:   #241a42;
  --ex-hero-end:   #391642;

  --ex-ink:        #1c2024;
  --ex-ink-soft:   #5b6570;
  --ex-surface:    #ffffff;
  --ex-surface-2:  #f6f8f9;
  --ex-border:     #e2e8ea;

  --ex-radius-s: 0.5rem;
  --ex-radius-m: 0.75rem;
  --ex-radius-l: 1.25rem;

  --ex-shadow-s: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --ex-shadow-m: 0 4px 12px rgba(16, 24, 40, 0.08);

  --ex-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--ex-font);
  /* The page is Turkish; tabular figures matter more here than anywhere else in the app, because
     proportional digits make a ticking clock jitter sideways once a second. */
  font-variant-numeric: tabular-nums;
  line-height: 1.65;
  color: var(--ex-ink);
  background: var(--ex-surface);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.6rem; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1rem; }

a { color: var(--ex-teal-600); }

/* Content column; every band paints edge to edge and constrains its contents with this. */
.ex-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.ex-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ nav */

.ex-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ex-surface);
  border-bottom: 1px solid var(--ex-border);
}

.ex-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  /* A flex item's automatic minimum size is its content, so without this the brand and the links
     each refuse to shrink and together push the bar wider than the viewport. */
  min-width: 0;
}

.ex-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.ex-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, var(--ex-teal-600), var(--ex-teal-400));
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
}

.ex-brand-word {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ex-ink);
}

.ex-brand-accent { color: var(--ex-teal-600); }

.ex-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.ex-nav-links > a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--ex-radius-s);
  color: var(--ex-ink);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 600;
  white-space: nowrap;
}

.ex-nav-links > a:hover { background: var(--ex-surface-2); }

.ex-nav-current { color: var(--ex-teal-600) !important; }

/* The burger is a checkbox-and-label toggle rather than a script: these pages are meant to be
   readable before any JavaScript runs, and a menu that needs JS to open is one more thing that
   can fail on the slow connection a search visitor is often on. */
.ex-nav-burger { display: none; }

@media (max-width: 900px) {
  .ex-nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.55rem;
    border-radius: var(--ex-radius-s);
    cursor: pointer;
  }
  .ex-nav-burger span {
    display: block;
    height: 2px;
    background: var(--ex-ink);
    border-radius: 2px;
  }
  .ex-nav-burger:hover { background: var(--ex-surface-2); }

  .ex-nav-inner { flex-wrap: wrap; }

  .ex-nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.15rem;
    padding-bottom: 0.85rem;
  }

  .ex-nav-toggle:checked ~ .ex-nav-links { display: flex; }

  .ex-nav-links > a { padding: 0.7rem 0.75rem; }
  .ex-nav-links .ex-btn { justify-content: center; margin-top: 0.35rem; }
}

/* -------------------------------------------------------------- buttons */

.ex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--ex-radius-s);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}

.ex-btn:hover { filter: brightness(1.08); }

.ex-btn--primary {
  background: linear-gradient(135deg, var(--ex-teal-600), var(--ex-teal-500));
  color: #fff !important;
  box-shadow: var(--ex-shadow-s);
}

.ex-btn--quiet {
  background: transparent;
  color: var(--ex-ink) !important;
}
.ex-btn--quiet:hover { background: var(--ex-surface-2); filter: none; }

.ex-btn--outline {
  background: transparent;
  border-color: var(--ex-border);
  color: var(--ex-ink) !important;
}
.ex-btn--outline:hover { background: var(--ex-surface-2); filter: none; }

/* On the dark hero and CTA bands an outline button needs light ink and a light edge. */
.ex-btn--on-dark {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff !important;
}
.ex-btn--on-dark:hover { background: rgba(255, 255, 255, 0.16); filter: none; }

.ex-btn--lg { padding: 0.85rem 1.7rem; font-size: 1rem; }

/*
 * A full-width button carries a descriptive label ("YDS 2026/1 İlkbahar detayları") rather than a
 * bare "Detaylar", because twenty identical link texts help neither a screen reader nor a search
 * engine. That makes the label as long as the exam name, so the nowrap inherited from .ex-btn has
 * to go here — a long name otherwise runs straight out through the side of its card.
 */
.ex-btn--block {
  display: flex;
  width: 100%;
  margin-top: auto;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- hero */

.ex-hero {
  background: linear-gradient(135deg, var(--ex-hero-start), var(--ex-hero-mid), var(--ex-hero-end));
  color: #fff;
  padding: 2.5rem 0 3rem;
}

.ex-hero h1 { color: #fff; }
.ex-hero a { color: var(--ex-teal-400); }

.ex-hero--hub { padding-bottom: 2.5rem; }

.ex-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
}

.ex-crumbs a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.ex-crumbs a:hover { text-decoration: underline; }

.ex-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ex-teal-400);
}

.ex-hero .ex-answer {
  max-width: 46rem;
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.88);
}

.ex-hero .ex-answer strong { color: #fff; }

/* ------------------------------------------------------------ countdown */

.ex-countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 34rem;
}

.ex-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.9rem 0.4rem 0.7rem;
  border-radius: var(--ex-radius-m);
}

.ex-num {
  font-size: clamp(1.6rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  /* The seconds column changes width between "9" and "10" on proportional digits, which drags
     the whole row sideways once a second. tabular-nums on body fixes the glyphs; this stops the
     boxes themselves from resizing as the day count crosses a power of ten. */
  font-variant-numeric: tabular-nums;
}

.ex-unit-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.ex-countdown--hero .ex-unit {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ex-countdown--hero .ex-num { color: #fff; }

.ex-countdown--card {
  margin: 0.75rem 0 1rem;
}

.ex-countdown--card .ex-unit {
  background: var(--ex-teal-50);
  border: 1px solid var(--ex-border);
  padding: 0.6rem 0.3rem 0.5rem;
}

.ex-countdown--card .ex-num {
  font-size: clamp(1.15rem, 3.6vw, 1.6rem);
  color: var(--ex-teal-700);
}

.ex-countdown-done {
  margin: 0.75rem 0 0;
  font-weight: 700;
  color: inherit;
  opacity: 0.85;
}

.ex-countdown-done[hidden] { display: none; }
.ex-countdown-grid[hidden] { display: none; }

/* ---------------------------------------------------------------- bands */

.ex-band { padding: 3rem 0; }
.ex-band--muted { background: var(--ex-surface-2); }

.ex-prose { max-width: 46rem; color: var(--ex-ink-soft); }

.ex-disclaimer {
  max-width: 46rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--ex-teal-500);
  border-radius: 0 var(--ex-radius-s) var(--ex-radius-s) 0;
  background: var(--ex-teal-50);
  font-size: 0.9rem;
  color: var(--ex-ink-soft);
}

/* ---------------------------------------------------------------- facts */

.ex-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.ex-fact {
  padding: 1rem 1.1rem;
  background: var(--ex-surface);
  border: 1px solid var(--ex-border);
  border-radius: var(--ex-radius-m);
  box-shadow: var(--ex-shadow-s);
}

.ex-fact dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ex-ink-soft);
  margin-bottom: 0.3rem;
}

.ex-fact dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  /* A pasted official URL has no spaces to break at and would otherwise push the card wide. */
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------- cards and lists */

.ex-lists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1.25rem;
}

.ex-list-card,
.ex-exam-card {
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  background: var(--ex-surface);
  border: 1px solid var(--ex-border);
  border-radius: var(--ex-radius-l);
  box-shadow: var(--ex-shadow-s);
}

.ex-exam-card h3 { margin-bottom: 0.25rem; }
.ex-exam-card h3 a { text-decoration: none; }
.ex-exam-card h3 a:hover { text-decoration: underline; }

.ex-card-date {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--ex-ink-soft);
}

.ex-list-count {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ex-ink-soft);
}

.ex-preview {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ex-preview th {
  text-align: right;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ex-ink-soft);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--ex-border);
}

.ex-preview th:first-child { text-align: left; }

.ex-preview td {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--ex-border);
  vertical-align: top;
}

.ex-preview td:first-child { font-weight: 650; }
.ex-preview td:last-child { text-align: right; color: var(--ex-ink-soft); }

/*
 * "Daha fazla göster".
 *
 * Both rules below exist because the HTML `hidden` attribute is only a UA stylesheet rule
 * (`display: none`) with the lowest possible precedence — any explicit `display` in this file
 * beats it. The card is `display: flex` and the button is `display: inline-flex` through
 * `.ex-btn`, so without these two selectors `hidden` would set the attribute, pass every test
 * that asks for it, and change nothing on screen.
 */
.ex-exam-card[hidden],
.ex-list-card[hidden] { display: none; }

.ex-btn[hidden] { display: none; }

.ex-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

.ex-more {
  min-width: 16rem;
  padding: 0.8rem 1.6rem;
}

.ex-past { list-style: none; margin: 0; padding: 0; }

.ex-past li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--ex-border);
}

.ex-past-date { font-size: 0.88rem; color: var(--ex-ink-soft); }

/* ------------------------------------------------------------------ faq */

.ex-faq { max-width: 46rem; }

.ex-faq details {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--ex-border);
}

.ex-faq summary {
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  list-style: none;
  /* Room for the marker drawn below; the native one differs per browser and cannot be styled. */
  padding-right: 1.75rem;
  position: relative;
}

.ex-faq summary::-webkit-details-marker { display: none; }

.ex-faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: -0.1rem;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  color: var(--ex-teal-600);
}

.ex-faq details[open] summary::after { content: "−"; }

.ex-faq details p {
  margin: 0.6rem 0 0;
  color: var(--ex-ink-soft);
}

/* ------------------------------------------------------------------ cta */

.ex-cta {
  padding: 3.25rem 0;
  background: linear-gradient(135deg, var(--ex-teal-700), var(--ex-plum-600));
  color: #fff;
  text-align: center;
}

.ex-cta h2 { color: #fff; }

.ex-cta p {
  max-width: 42rem;
  margin: 0 auto 1.5rem;
  color: rgba(255, 255, 255, 0.85);
}

.ex-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.ex-cta-note {
  margin: 1.1rem auto 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* --------------------------------------------------------------- footer */

.ex-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--ex-border);
  background: var(--ex-surface);
}

.ex-footer .ex-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ex-footer-copy {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ex-ink-soft);
}

.ex-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.88rem;
}

.ex-footer-links a { text-decoration: none; }
.ex-footer-links a:hover { text-decoration: underline; }

/* ----------------------------------------------------- error pages */

/*
 * templates/error/** shares this stylesheet rather than carrying its own. The error pages are the
 * same family as the countdown pages — server-rendered, anonymous, light only — and everything
 * they need except the rules below is already here.
 *
 * An error page is the one page in the app with nothing under the fold: a heading, a sentence and
 * two links. Left alone it ends a third of the way down the viewport and strands the footer above
 * a field of white. So the page is a flex column pinned to the viewport height and the hero takes
 * the slack — the footer sits on the bottom edge at any window size, rather than at whatever
 * height a guessed min-height happened to produce. Scoped to a body class so the long countdown
 * pages, which fill the screen on their own, are untouched.
 */
.ex-error-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ex-error-body main {
  display: flex;
  flex: 1;
}

/* Centred in the band it was just given, so the text stays optically placed as the band grows. */
.ex-error {
  display: flex;
  flex: 1;
  align-items: center;
  padding: 3.5rem 0 4rem;
}

.ex-error > .ex-shell { width: 100%; }

.ex-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/*
 * One English line under the Turkish. These pages are Turkish like the rest of templates/, but
 * unlike the exam pages they are reachable from inside the app, where half the users read English.
 * A whole second copy is not worth the machinery — Spring MVC does not see the Vaadin locale —
 * so this says the same thing quietly enough to be skipped by anyone who does read Turkish.
 */
.ex-error-alt {
  margin: 1.6rem 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
}

/* ----------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
