/* ============================================================
   style.css — Schaak maar raak Academy — Basistemplate
   Generieke huisstijl-onderdelen (header, bedieningsbalk, knoppen,
   info-modal, inhoudskader, footer) — opbouw naar ZETWERK DiagramPrint.
   App-specifieke inhoud (bord, panelen, enz.) hoort NIET hier,
   maar in eigen CSS die je aan deze template toevoegt.
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Huisstijl */
  --parchment:      #f5eedf;
  --parchment-mid:  #ede4cf;
  --parchment-dark: #e4d8bf;
  --parchment-deep: #d6c9aa;
  --ink:            #1a1209;
  --ink-mid:        #3d2f1a;
  --ink-light:      #7a6a55;
  --burgundy:       #6b1414;
  --burgundy-hover: #8b2235;
  --gold:           #9a7530;
  --gold-light:     #b8924a;
  --rule:           #c8b89a;
  --rule-heavy:     #8c7355;
  /* Lichte tekst op het donkere hout (header, footer) */
  --cream:          #f1e2c3;

  /* "Houten bureau": header, achtergrond en footer zijn hetzelfde donkere hout.
     De tint-laag houdt de lichte tekst leesbaar en de nerf subtiel. Balken en
     kaarten daarop blijven vlak perkament met donkere tekst. */
  --tex-board-light: url("../images/wood/set_light/board-light.webp");
  --tex-board-dark:  url("../images/wood/set_light/board-dark.webp");
  --surface-wood:   linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)), var(--tex-board-dark);
  /* Header en footer iets donkerder, zodat ze als lijst om het werkblad staan */
  --frame-wood:     linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), var(--tex-board-dark);
  --wood-repeat:    no-repeat, repeat;
  --wood-size:      100% 100%, 600px 600px;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Libre Baskerville', Georgia, serif;
  --font-ui:      'Montserrat', sans-serif;
  --font-mono:    'Courier New', monospace;

  /* Breedte van de inhoud en de bedieningsbalk — per app aan te passen */
  --max-width: 1200px;
}

/* Donkere houttextuur-set — activeer met html[data-wood="dark"] als je app
   (net als het DemoBord) een licht/donker-keuze in de header wil aanbieden. */
html[data-wood="dark"] {
  --tex-board-light: url("../images/wood/set_dark/board-light.webp");
  --tex-board-dark:  url("../images/wood/set_dark/board-dark.webp");
}

/* ============================================================
   1b. LETTERTYPEN — lokaal gehost (offline-proof)
   Latijnse subset, woff2. Licenties: fonts/OFL-*.txt (SIL OFL 1.1).
   ============================================================ */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/librebaskerville-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/librebaskerville-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/montserrat-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/playfairdisplay-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/playfairdisplay-italic-latin.woff2') format('woff2');
}

/* ============================================================
   2. RESET & BASIS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  background-color: #2a170d;               /* donker-hout fallback als de webp mist */
  background-image: var(--surface-wood);
  background-repeat: var(--wood-repeat);
  background-size: var(--wood-size);
  background-attachment: fixed;
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   3. SITE-HEADER
   ============================================================ */
.site-header {
  background-color: #2f2114;
  background-image: var(--frame-wood);
  background-repeat: var(--wood-repeat);
  background-size: var(--wood-size);
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  padding: 8px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: relative;
  z-index: 2;              /* schaduw valt over de bedieningsbalk */
  gap: 12px;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rule), var(--gold-light), var(--rule));
}

/* Geen bedieningsbalk direct onder de header: geen schaduw of rand, maar
   een dunne goudlijn onderaan als scheiding met het hout */
.site-header:not(:has(+ .controls-bar)) {
  box-shadow: none;
  border-bottom: none;
}
.site-header:not(:has(+ .controls-bar))::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rule), var(--gold-light), var(--rule));
}

.header-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  justify-self: start;   /* alleen het logo klikbaar, niet de lege ruimte ernaast */
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  margin-left: 10px;
}

.logo-main {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  font-variant-caps: all-small-caps;
  color: var(--cream);
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.logo-sub {
  font-family: var(--font-ui);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cream);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.header-logo-icon {
  width: 52px;
  height: 52px;
  background-color: var(--ink);
  background-image: url('../images/logo-icon.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 55%;
  flex-shrink: 0;
  border: 2px solid var(--rule-heavy);
}

.header-title {
  font-family: var(--font-ui);
  font-size: clamp(1.3rem, 3.6vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-caps: small-caps;
  color: var(--cream);
  text-align: center;
  justify-self: center;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

@media (max-width: 1024px) {
  .header-title { letter-spacing: 0; }
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  justify-self: end;
}

/* Rond knopje i (info) */
.info-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gold-light);
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.info-btn:hover { background: var(--burgundy); }

/* Taalkeuze NL / EN / DE, rechtsboven in de header */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 -2px 3px rgba(0, 0, 0, 0.15);
}

.lang-btn {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border: none;
  border-left: 1px solid var(--rule);
  background: var(--parchment);
  color: var(--ink-mid);
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.lang-btn:first-child { border-left: none; }
.lang-btn:hover { background: var(--parchment-dark); }

.lang-btn.is-active {
  background: var(--ink);
  color: var(--parchment);
}

/* Responsief: op smalle schermen logo-tekst verbergen, alleen icoon */
@media (max-width: 768px) {
  .header-logo-text { display: none; }
}
@media (max-width: 600px) {
  .site-header { padding: 6px 12px; }
  .header-actions { gap: 6px; }
}
/* Telefoonbreedte: logo en knoppen op de bovenste rij, titel eronder */
@media (max-width: 500px) {
  .site-header {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "logo actions"
      "title title";
    row-gap: 6px;
  }
  .header-logo    { grid-area: logo; }
  .header-actions { grid-area: actions; }
  .header-title   { grid-area: title; }
}

/* ============================================================
   4. BEDIENINGSBALK (perkament, direct onder de header)
   ============================================================ */
.controls-bar {
  background: var(--parchment);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30);
  padding: 0.75rem 1rem;
  position: relative;
  z-index: 1;
}

.controls-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Groep met bestandsknoppen + bestandsnaam eronder */
.control-group--files {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.file-buttons-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-name {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-mid);
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ============================================================
   5. KNOPPEN
   ============================================================ */
.btn,
.file-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--rule-heavy);
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--burgundy);
  color: var(--parchment);
  border-color: var(--burgundy);
}
.btn-primary:hover { background: var(--burgundy-hover); border-color: var(--burgundy-hover); }

.btn-outline,
.file-btn {
  background: transparent;
  color: var(--ink);
}
.btn-outline:hover,
.file-btn:hover { background: var(--parchment-dark); border-color: var(--gold); }

.btn:focus-visible,
.file-btn:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Uitgeschakeld: gedempt, maar nog leesbaar */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Verborgen file-input in een label, gestyled als knop */
.file-btn input[type="file"] { display: none; }

/* ============================================================
   6. MODALS (info-modal en overige sm-overlay-vensters)
   ============================================================ */
.sm-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 18, 9, 0.78);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.17s;
}

.sm-overlay.open { opacity: 1; pointer-events: all; }

.sm-modal {
  background: var(--parchment);
  border: 1px solid var(--gold);
  border-top: 4px solid var(--burgundy);
  padding: 22px;
  width: 440px; max-width: 92vw;
  box-shadow: 0 8px 32px rgba(26, 18, 9, 0.45);
}

.sm-modal h3 {
  font-family: var(--font-display);
  color: var(--burgundy);
  margin-bottom: 12px;
  font-size: 1.15rem;
  font-weight: 700;
}

.info-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink);
}

.info-label {
  font-weight: 700;
  color: var(--ink-mid);
  font-size: 0.72rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  min-width: 120px;
}

.info-links {
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.info-link {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--burgundy);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.info-link:hover { text-decoration: underline; }

.info-copyright {
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 0.74rem;
  color: var(--ink-mid);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-modal-btns { display: flex; gap: 6px; justify-content: flex-end; }

/* ============================================================
   7. HOOFDINHOUD (placeholder — vul aan per app)
   ============================================================ */
/* max-width + 2rem: de zijpadding valt erbuiten, zodat het kader precies
   even breed is als de knoppenrij in de bedieningsbalk */
main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--max-width) + 2rem);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

/* Perkamentkaart op het donkere hout */
.container {
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  border-radius: 2px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.42);
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--ink-mid);
  font-family: var(--font-body);
  font-style: italic;
}

/* ============================================================
   8. SITE-FOOTER (donker hout, net als de header)
   ============================================================ */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  padding: 0.8rem 1rem 0.7rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  background-color: #2f2114;
  background-image: var(--frame-wood);
  background-repeat: var(--wood-repeat);
  background-size: var(--wood-size);
  margin-top: auto;
  position: relative;
}

/* Dunne goudlijn bovenaan de footer als scheiding met het hout */
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rule), var(--gold-light), var(--rule));
}

.site-footer .dot {
  color: var(--gold-light);
  user-select: none;
}

.site-footer a {
  color: var(--cream);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--gold-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}
