/* Reset, typography classes, buttons, forms and small shared components. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:active {
  color: var(--blue-hover);
  text-decoration-thickness: 2px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--blue);
  color: var(--white);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Navy and blue surfaces: white text, white focus ring, white headings. */
.on-dark {
  --focus: var(--white);
  --heading: var(--white);
  color: var(--white);
}

.on-dark a:not(.btn) {
  color: var(--white);
}

/* While English copy loads for a returning EN visitor, hide the Albanian
   fallback. The animation reveals the page anyway if JS never finishes. */
.i18n-pending body {
  visibility: hidden;
  animation: i18n-reveal 0s linear 1.5s forwards;
}

@keyframes i18n-reveal {
  to {
    visibility: visible;
  }
}

/* Typography -------------------------------------------------------------- */
.t-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-display);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.t-h2 {
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.t-h3 {
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  line-height: 1.25;
}

.t-h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-h4);
  line-height: 1.35;
}

.t-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-sub);
  line-height: 1.4;
}

.t-lead {
  max-width: 36em;
  font-size: var(--fs-lead);
  line-height: 1.55;
}

.t-body {
  max-width: 34em;
  font-size: var(--fs-body);
  line-height: 1.6;
}

.t-small {
  font-size: var(--fs-small);
  line-height: 1.5;
}

.t-meta {
  font-weight: 600;
  font-size: var(--fs-meta);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.t-num {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
}

.t-display,
.t-h2,
.t-h3,
.t-h4 {
  text-wrap: balance;
}

p,
dd,
li {
  text-wrap: pretty;
}

.muted {
  color: var(--muted);
}

/* Layout helpers ---------------------------------------------------------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Reveal on scroll (js/reveal.js). Only the script adds .reveal, and only to
   elements below the fold, so nothing stays hidden if it doesn't run. */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity 450ms ease-out, transform 450ms ease-out;
  transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* data-i18n-stable (js/i18n.js): each language's text in the same grid cell, only
   the current one visible, so the element keeps one size in every language. */
.i18n-stable {
  display: inline-grid;
  vertical-align: top;
}

.i18n-stable > * {
  grid-area: 1 / 1;
}

.i18n-stable__ghost {
  visibility: hidden;
}

.btn .i18n-stable {
  justify-items: center;
}

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-btn);
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--white);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Icons: stroke style, inherit currentColor. */
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 18px;
  height: 18px;
}

.icon--lg {
  width: 32px;
  height: 32px;
  stroke-width: 1.8;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 50px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  background: transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-body);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn--sm {
  min-height: 44px;
  padding: 0 16px;
  font-size: var(--fs-small);
}

/* Blue: general primary action */
.btn--primary {
  background: var(--blue);
  color: var(--white);
}

.btn--primary:hover,
.btn--primary:active {
  background: var(--blue-hover);
  color: var(--white);
}

/* Crimson: reserved for "Register" actions. Never on a blue surface. */
.btn--accent {
  background: var(--crimson);
  color: var(--white);
}

.btn--accent:hover,
.btn--accent:active {
  background: var(--crimson-hover);
  color: var(--white);
}

/* Outline buttons use a 1.5px border */
.btn--ghost,
.btn--ghost-dark {
  border-width: 1.5px;
}

.btn--ghost {
  border-color: var(--blue);
  color: var(--blue);
}

.btn--ghost:hover,
.btn--ghost:active {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
  color: var(--white);
}

/* White outline, for navy surfaces */
.btn--ghost-dark {
  border-color: var(--white);
  color: var(--white);
}

.btn--ghost-dark:hover,
.btn--ghost-dark:active {
  background: var(--white);
  color: var(--navy);
}

/* Solid white, for blue and navy surfaces (crimson can't sit on blue) */
.btn--light {
  background: var(--white);
  color: var(--navy);
}

.btn--light:hover,
.btn--light:active {
  background: var(--ice);
  color: var(--navy);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Forms ------------------------------------------------------------------- */
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

fieldset.field > legend {
  margin-bottom: var(--space-2);
}

.field {
  display: grid;
  align-content: start;
  gap: var(--space-2);
}

.field__label {
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
}

.field__optional {
  font-weight: 400;
  color: var(--muted);
}

.field__hint {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
}

/* Errors never rely on colour alone: alert icon + message + 2px border. */
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.5;
  color: var(--error);
}

.field__error .icon {
  margin-top: 2px;
}

.input,
.select {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-btn);
  background-color: var(--white);
  color: var(--navy);
  font-size: var(--fs-body);
  line-height: 1.4;
}

.select {
  appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B2551' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
  background-size: 20px;
  cursor: pointer;
}

.input--narrow {
  max-width: 8rem;
}

.input:hover,
.select:hover {
  border-color: var(--navy);
}

.input:focus-visible,
.select:focus-visible {
  border-color: var(--blue);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
  border: 2px solid var(--error);
}

.check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.check input {
  width: 24px;
  height: 24px;
  margin: 10px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.check label {
  min-height: 44px;
  padding-block: 9px;
  line-height: 1.5;
  cursor: pointer;
}

.check + .field__hint,
.check + .field__error {
  padding-left: calc(24px + var(--space-3));
}

/* Radio group options, stacked */
.choices {
  display: grid;
}

/* Error summary: navy text; crimson only on the border and the icon */
.error-summary {
  padding: var(--space-4) var(--space-5);
  border: 2px solid var(--error);
  border-radius: var(--radius-md);
  background: var(--white);
}

.error-summary__title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--navy);
}

.error-summary__title .icon {
  margin-top: 2px;
  color: var(--error);
}

.error-summary__list {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.error-summary__list:empty {
  display: none;
}

.error-summary__list a {
  color: var(--navy);
  font-weight: 600;
}

/* "Add to calendar" disclosure -------------------------------------------- */
.cal {
  position: relative;
  display: inline-block;
}

.cal__chevron {
  transition: transform 0.15s ease;
}

.cal [aria-expanded="true"] .cal__chevron {
  transform: rotate(180deg);
}

.cal__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 20;
  min-width: 264px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.cal__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: 8px;
  color: var(--navy);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}

.cal__item:hover {
  background: var(--ice);
  color: var(--navy);
}

.cal__item .icon {
  color: var(--blue);
}

@media (min-width: 760px) {
  .cal--end .cal__menu {
    right: 0;
    left: auto;
  }
}

/* Dialog: test types (opened from the risk band, js/test-modal.js) --------- */
.test-modal {
  width: min(600px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 24px 64px -16px rgb(11 37 81 / 0.55);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.test-modal::backdrop {
  background: rgb(11 37 81 / 0.65);
}

/* While the dialog is open the page behind it doesn't scroll (and doesn't shift). */
html.has-modal {
  overflow: hidden;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: no-preference) {
  .test-modal[open] {
    animation: test-modal-in 0.2s ease-out;
  }

  .test-modal[open]::backdrop {
    animation: test-modal-fade 0.2s ease-out;
  }
}

@keyframes test-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes test-modal-fade {
  from {
    opacity: 0;
  }
}

/* The X stays in the corner while the content scrolls underneath it. */
.test-modal__close {
  position: sticky;
  top: 12px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 12px 12px -56px auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 2px 10px rgb(11 37 81 / 0.28);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.test-modal__close:hover,
.test-modal__close:active {
  background: var(--ice);
}

.test-modal__media {
  height: 200px;
  background: var(--ice);
}

.test-modal__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%; /* the strip is much wider than the photo: keep the building, not the paving */
}

.test-modal__body {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5) clamp(20px, 5vw, 32px) clamp(20px, 5vw, 32px);
}

/* No picture: leave room for the X. */
.test-modal__media[hidden] + .test-modal__body {
  padding-top: 64px;
}

.test-modal__body .btn {
  justify-self: center;
  min-width: 160px;
}

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

.test-list li {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
}

.test-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.test-list__name {
  display: block;
  font-weight: 700;
}

.test-list__text {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.test-modal__info {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--ice);
}

.test-modal__info p {
  margin: 0;
}

.test-modal__free {
  font-weight: 600;
}

/* Motion ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
