/* ============================================
   PadelThailand.com — Poster Wall
   Editorial month grid of Instagram tournament posters.
   Tokens mirror css/styles.css so the theme choice carries between the two pages.
   ============================================ */

:root {
  --wall-gap: 8px;
  --transition: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --border: #333;
  --text-primary: #f0f0f0;
  --text-secondary: #aaa;
  --text-muted: #888;
  --header-bg: rgba(15, 15, 15, 0.88);
  --focus-color: #6b9fff;
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaeaea;
  --border: #ddd;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #777;
  --header-bg: rgba(245, 245, 245, 0.88);
  --focus-color: #2563eb;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-smooth), color var(--transition-smooth);
}

a { color: inherit; text-decoration: none; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 12px; }

/* ---- Header ---- */

.wall-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px clamp(10px, 2vw, 20px);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.wall-logo img { display: block; height: 20px; width: auto; }
/* Same pairing as css/styles.css:148 — the "dark" asset is the one for the dark theme. */
[data-theme="dark"] .logo-light,
[data-theme="light"] .logo-dark { display: none; }

.wall-nav { display: flex; align-items: center; gap: 6px; }

.wall-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.wall-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.wall-btn--icon { width: 28px; padding: 0; justify-content: center; }
.wall-btn svg { width: 14px; height: 14px; }

[data-theme="dark"] .theme-icon-moon,
[data-theme="light"] .theme-icon-sun { display: none; }

/* ---- Masthead ---- */
/* One compact line. The year is outlined rather than filled so the month reads first,
   and the whole block stays out of the posters' way. */

.masthead {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(10px, 2vw, 22px);
  padding: clamp(14px, 2.4vw, 26px) clamp(10px, 2vw, 20px) 4px;
}

.masthead-title {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  min-width: 0;
}

.masthead-month {
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.masthead-year {
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1px var(--text-muted);
  user-select: none;
}

.masthead-nav {
  flex: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition), transform var(--transition);
}
.masthead-nav:hover { color: var(--text-primary); transform: scale(1.18); }

.masthead-count {
  margin: 0 auto 12px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Wall ---- */

/* Pinterest packing. Tiles are positioned by JS (see layout() in poster-wall.js), which
   is why this is a plain positioned box rather than a grid: CSS grid places items row by
   row, so a tall tile leaves a staircase hole beneath it. `gap` is read by that code. */
.wall {
  position: relative;
  gap: var(--wall-gap);
  padding: 0 clamp(8px, 1.4vw, 16px) clamp(28px, 5vw, 56px);
}

/* Each tile takes its artwork's own proportions, so cover crops nothing. */
.tile {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--org, transparent) 26%, transparent), transparent 75%),
    var(--bg-tertiary);
}

.tile-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.tile:hover .tile-img,
.tile:focus-visible .tile-img { transform: scale(1.04); }

/* The day, and nothing else — the masthead supplies the month and the poster supplies
   the name. Set large, a step below the masthead, so the wall reads as a calendar. */
.tile-date {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto 0;
  padding: 7px 12px 30px;
  /* Holds near-full strength across the glyph band before fading, so the numeral stays
     legible on posters that are white at the top. */
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.66) 45%, transparent 100%);
  color: #fff;
  /* Scaled from the tile width set by layout(), so the numeral keeps the same
     proportion whether the tile is 150px or 380px wide. */
  font-size: clamp(15px, calc(var(--tile-w, 250px) * 0.085), 30px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* Fallback tile — no Instagram poster yet, so the organizer's square brand image
   carries it, over a wash of the organizer's colour. */

.tile--fallback {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--org) 34%, transparent), transparent 72%),
    var(--bg-secondary);
}

/* ---- Empty state ---- */

.wall-empty {
  padding: clamp(40px, 12vw, 120px) 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.wall-loading {
  padding: 80px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ---- Footer ---- */

.wall-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
  padding: 28px 24px 56px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.wall-footer a:hover { color: var(--text-primary); }

/* Touch ergonomics. On a finger the month arrows are the primary control of the page,
   so they get the full 44px; the secondary header chrome gets 40px, which clears WCAG
   2.5.8 comfortably while keeping the header strip thin. */
@media (pointer: coarse) {
  .masthead-nav { width: 44px; height: 44px; }
  .wall-btn { height: 40px; }
  .wall-btn--icon { width: 40px; }
  .wall-nav { gap: 8px; }
}

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