/*
 * SKI.MD shared site stylesheet
 *
 * Stage 1 foundation. This file is intentionally compatible with the existing
 * table-based HTML while pages are migrated incrementally.
 *
 * Server-managed photographs are not referenced here. Existing image URLs,
 * including files omitted from Git for space reasons and foto_var paths, remain
 * page-owned and must be preserved during migration.
 */

:root {
  color-scheme: light;
  --page-bg: #eef4f8;
  --surface: #ffffff;
  --surface-muted: #f5f8fa;
  --text: #17212b;
  --muted: #586674;
  --brand: #2069bc;
  --brand-dark: #154d8b;
  --border: #c7d2dc;
  --focus: #8a3ffc;
  --content-width: 1200px;
  --page-width: min(calc(100% - 2rem), var(--content-width));
  --radius: 0.5rem;
  --shadow: 0 0.25rem 1rem rgb(20 45 70 / 10%);
}

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

html {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
}

body > table,
.site-shell {
  width: min(100%, var(--content-width)) !important;
  max-width: var(--content-width);
  margin-inline: auto;
  background: var(--surface);
}

body > table:first-of-type {
  box-shadow: var(--shadow);
}

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

img[width][height] {
  object-fit: contain;
}

a {
  color: var(--brand-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--brand);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0.2rem solid var(--focus);
  outline-offset: 0.15rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  text-wrap: balance;
}

p,
li,
td,
th {
  overflow-wrap: anywhere;
}

table {
  border-collapse: collapse;
}

th {
  text-align: left;
}

input,
button,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

/* Compatibility helpers for gradually modernized pages. */
.site-header,
.site-main,
.site-layout,
.site-footer,
.site-section {
  width: var(--page-width);
  max-width: var(--content-width);
  margin-inline: auto;
  box-sizing: border-box;
}

.site-header,
.site-footer {
  margin-block: 1rem;
}

.site-main {
  padding: 0;
}

.site-section {
  padding: clamp(1rem, 2.5vw, 2rem);
}

.site-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}

.site-main > .site-grid {
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  align-items: start;
}

.site-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.site-layout > .site-sidebar {
  min-width: 0;
}

.site-layout > .site-main {
  width: auto;
  min-width: 0;
  margin: 0;
}

.site-nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-main nav .site-nav-list {
  display: grid;
  gap: 0.25rem;
}

.site-layout .site-nav-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

.site-layout .site-nav-list a {
  display: block;
}

.site-nav-list a {
  display: inline-block;
  padding-block: 0.45rem;
}

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

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

@media (max-width: 760px) {
  body > table,
  body > table > tbody,
  body > table > tbody > tr,
  body > table > tbody > tr > td {
    max-width: 100%;
  }

  body > table {
    width: 100% !important;
  }

  body > table > tbody > tr > td {
    min-width: 0;
  }

  .site-main > .site-grid {
    grid-template-columns: 1fr;
  }

  .site-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-nav-list,
  .site-main nav .site-nav-list,
  .site-layout .site-nav-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }
}

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

@media print {
  body {
    background: #fff;
  }

  body > table,
  .site-shell {
    width: 100% !important;
    max-width: none;
    box-shadow: none;
  }

  a[href]::after {
    content: none;
  }
}

/* Shared semantic page patterns used by the homepage and federation page. */
.site-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  align-items: center;
}

.site-brand > img,
.site-brand-art img {
  max-height: 6rem;
}

.site-title {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
}

.site-subtitle {
  margin: 0.25rem 0 0;
  font-weight: 700;
}

.welcome {
  margin-bottom: 1rem;
  text-align: center;
}

.welcome h1 {
  margin: 0.45rem 0 0;
  color: var(--brand);
  font-size: clamp(2rem, 5vw, 3rem);
}

.site-sidebar,
.partner-links {
  display: grid;
  gap: 1rem;
}

.partner-links a {
  display: block;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-image {
  display: block;
  width: 100%;
  margin-inline: auto;
}

.event-list {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.4rem;
}

.event-list li {
  padding-left: 0.25rem;
}

.result-highlight {
  color: #9b0077;
}

.federation-page > h1,
.federation-page > .site-subtitle,
.federation-summary,
.contact-details {
  text-align: center;
}

.site-footer {
  color: #fff;
  background: var(--brand-dark);
  padding-block: 0.35rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.athletes-page {
  text-align: center;
}

.athlete-intro {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

@media (max-width: 520px) {
  .site-brand {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .site-brand-art {
    display: none;
  }
}

.event-page {
  text-align: center;
}

.event-page h1 {
  margin-top: 0;
  color: var(--text);
}

.event-page p {
  margin-block: 1rem;
}

.event-page img {
  display: block;
  margin-inline: auto;
}

.event-page .result-highlight {
  color: #c00000;
  font-weight: 700;
}
