/* ============================================================
 * Apple Fest Public Site — shared styles
 * Two visual directions:
 *   [data-dir="hometown"] — block-print folk, red on cream, Oswald headlines
 *   [data-dir="editorial"] — crisp navy/white, serif headlines, modern grids
 * Uses real brand tokens from colors_and_type.css.
 * ============================================================ */

/* Tokens are loaded before this file via index.html — keeping the import
   avoids breakage if the file is pulled in standalone (e.g. a style tool). */
@import url('./tokens.css');

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* Public-site overrides for body (stronger than tokens default) */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--af-black);
  background: var(--af-cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Root tweaks for public pages */
:root {
  --ink:         #1c1917;
  --ink-mid:     #44403c;
  --ink-light:   #78716c;
  --rule:        #E7E2D7;
  --rule-dk:     #D6D0C2;
  --red:         var(--af-red);          /* #e51e25 */
  --red-deep:    #B01216;
  --red-soft:    #fde8e8;
  --red-pale:    #FFF5F3;
  --sky:         var(--af-sky);          /* #41b6e6 */
  --sky-pale:    #E7F5FC;
  --royal:       #1B4494;                /* brighter than tokens' deep navy — matches entertainment sign */
  --royal-deep:  #0A2E72;
  --royal-pale:  #E9EEF9;
  --gold:        var(--af-gold);
  --cream:       var(--af-cream);
  --parchment:   var(--af-parchment);
  --white:       #ffffff;

  --max-w: 1200px;
  --max-w-narrow: 760px;

  --sh-sm: 0 1px 3px rgba(26,20,15,.06), 0 1px 2px rgba(26,20,15,.04);
  --sh-md: 0 4px 16px rgba(26,20,15,.08), 0 1px 4px rgba(26,20,15,.04);
  --sh-lg: 0 14px 44px rgba(26,20,15,.14), 0 4px 12px rgba(26,20,15,.06);
}

/* headings reset so public page uses its own display rules */
h1, h2, h3, h4 { text-transform: none; letter-spacing: 0; color: inherit; }

a { color: var(--red-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ========== FOCUS STATES (keyboard navigation) ========== */
/* One consistent focus ring site-wide. Ink outline + offset works
   over both dark (hero, navy sections) and light backgrounds; gold
   variant for use on the red hero where ink disappears. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 2px;
}
.home-hero a:focus-visible,
.home-hero button:focus-visible,
.page-banner-red a:focus-visible,
.page-banner-red button:focus-visible,
.home-cta-band a:focus-visible,
.home-cta-band button:focus-visible {
  outline-color: var(--gold);
}
.pub-footer a:focus-visible {
  outline-color: var(--gold);
}

/* Disabled buttons: honest semantic state, not just visual. Paired
   with aria-disabled on the markup side for assistive tech. */
button[disabled], button[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed;
}
button[disabled]:hover, button[aria-disabled="true"]:hover {
  transform: none;
}

/* ========== DISPLAY FONT (direction-aware) ========== */
/* HOMETOWN: Oswald block-letter + italic accents (matches the real signage) */
[data-dir="hometown"] .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
[data-dir="hometown"] .display-italic {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* EDITORIAL: serif H, sentence case, tighter */
[data-dir="editorial"] .display {
  font-family: Georgia, 'Iowan Old Style', 'Playfair Display', serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
}

/* ========== HEADER ========== */
.pub-header {
  background: var(--white);
  border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; z-index: 50;
}
.pub-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex; align-items: center; gap: 32px;
  position: relative;
}
.pub-brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink);
  cursor: pointer; background: none; border: none; padding: 0;
}
.pub-brand:hover { text-decoration: none; }
.pub-brand-mark { flex-shrink: 0; }
.pub-brand-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 19px; line-height: 1; text-transform: uppercase;
  letter-spacing: 0.02em;
}
.pub-brand-sub {
  font-size: 11px; color: var(--ink-light);
  margin-top: 4px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 600;
}
.pub-nav { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.pub-nav-link {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  color: var(--ink-mid);
  padding: 9px 13px;
  border-radius: 3px;
  cursor: pointer; transition: color .12s, background .12s;
  text-transform: uppercase; letter-spacing: .06em;
  background: none; border: none;
}
.pub-nav-link:hover { color: var(--red-deep); background: var(--red-pale); text-decoration: none; }
.pub-nav-link.active { color: var(--red); }
.pub-nav-link.active::after {
  content: ""; display: block; height: 3px; background: var(--red);
  margin-top: 5px; margin-bottom: -12px;
  border-radius: 2px;
}
.pub-nav-cta {
  background: var(--red); color: #fff; margin-left: 10px;
  padding: 10px 18px;
}
.pub-nav-cta:hover { background: var(--red-deep); color: #fff; }
.pub-nav-cta.active::after { display: none; }

.pub-mobile-toggle {
  display: none; margin-left: auto;
  background: none; border: 1.5px solid var(--ink);
  width: 42px; height: 42px; border-radius: 4px;
  font-size: 18px; color: var(--ink);
}

@media (max-width: 920px) {
  .pub-nav { display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--white); border-bottom: 2px solid var(--ink);
    flex-direction: column; align-items: stretch; padding: 12px; gap: 2px;
    box-shadow: var(--sh-md); }
  .pub-nav.open { display: flex; }
  .pub-nav-link { text-align: left; padding: 12px 14px; }
  .pub-nav-link.active::after { display: none; }
  .pub-nav-cta { text-align: center; margin-left: 0; margin-top: 6px; }
  .pub-mobile-toggle { display: flex; align-items: center; justify-content: center; }
}

/* EDITORIAL header — lose the bold rule, use thin underline */
[data-dir="editorial"] .pub-header { border-bottom: 1px solid var(--rule); }
[data-dir="editorial"] .pub-nav-link { letter-spacing: .02em; text-transform: none; font-size: 15px; font-weight: 500; }
[data-dir="editorial"] .pub-nav-link.active::after { background: var(--ink); }
[data-dir="editorial"] .pub-brand-name { letter-spacing: 0.01em; }

/* ========== FOOTER ========== */
.pub-footer {
  background: var(--royal);
  color: rgba(255,255,255,.9);
  padding: 64px 28px 28px;
  margin-top: 96px;
  position: relative;
  overflow: hidden;
}
.pub-footer::before {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='%2341b6e6' opacity='.12'><circle cx='30' cy='30' r='2'/><circle cx='170' cy='40' r='1.5'/><circle cx='40' cy='160' r='1.5'/><circle cx='160' cy='170' r='2'/><circle cx='100' cy='20' r='1.2'/><circle cx='20' cy='100' r='1.2'/><circle cx='180' cy='100' r='1.2'/></g></svg>");
  background-size: 400px 400px;
  pointer-events: none;
}
.pub-footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; gap: 40px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  position: relative;
}
@media (max-width: 800px) {
  .pub-footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
  .pub-footer-brand { grid-column: 1 / -1; }
}
.pub-footer-brand .pub-brand-name, .pub-footer-brand .pub-brand-sub { color: #fff; }
.pub-footer-brand .pub-brand-sub { color: rgba(255,255,255,.6); }
.pub-footer-brand p {
  color: rgba(255,255,255,.75); font-size: 14px; margin-top: 16px; line-height: 1.6;
  max-width: 320px;
}
.pub-footer h4 {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  font-size: 13px; color: #fff; margin-bottom: 16px; font-weight: 700;
}
.pub-footer-col a { color: rgba(255,255,255,.8); display: block; padding: 5px 0; font-size: 14px; }
.pub-footer-col a:hover { color: #fff; text-decoration: none; }
.pub-footer-bottom {
  max-width: var(--max-w); margin: 48px auto 0;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,.18);
  font-size: 12.5px; color: rgba(255,255,255,.6);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  position: relative;
}

/* ========== PAGE CONTAINER ========== */
.pub-page { min-height: calc(100vh - 100px); }
.pub-container { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; }
.pub-container.narrow { max-width: var(--max-w-narrow); }

/* ========== BUTTONS ========== */
.btn {
  font-family: var(--font-body);
  font-weight: 700; font-size: 14px;
  padding: 13px 22px; border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer; transition: transform .12s, background .12s, border-color .12s, color .12s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: .03em; text-transform: uppercase;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: #fff; text-decoration: none; }
.btn-navy { background: var(--royal); color: #fff; }
.btn-navy:hover { background: var(--royal-deep); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--red-deep); padding: 8px 14px; border: none; }
.btn-ghost:hover { background: var(--red-pale); text-decoration: none; color: var(--red-deep); }
.btn-lg { padding: 17px 30px; font-size: 15px; }
.btn-white { background: #fff; color: var(--red-deep); }
.btn-white:hover { background: var(--cream); color: var(--red-deep); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

[data-dir="editorial"] .btn { text-transform: none; letter-spacing: 0; font-weight: 600; border-radius: 3px; }

/* ========== SECTIONS ========== */
.section { padding: 80px 0; }
.section-sm { padding: 52px 0; }
@media (max-width: 640px) { .section { padding: 52px 0; } .section-sm { padding: 36px 0; } }

.eyebrow {
  font-family: var(--font-display); font-weight: 600;
  font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--red-deep); margin-bottom: 14px;
}
[data-dir="editorial"] .eyebrow { color: var(--ink-mid); letter-spacing: .2em; }

.section-title {
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.02;
  margin-bottom: 16px;
  color: var(--ink);
  text-wrap: balance;
}
.section-lede {
  font-size: 18px; color: var(--ink-mid); line-height: 1.6;
  max-width: 640px; text-wrap: pretty;
}

/* ========== CARDS ========== */
.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 28px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card-hover:hover { border-color: var(--rule-dk); box-shadow: var(--sh-md); transform: translateY(-2px); }
.card-title { font-size: 20px; margin-bottom: 8px; font-weight: 700; }
.card-body { color: var(--ink-mid); font-size: 15px; line-height: 1.6; }

[data-dir="hometown"] .card { border: 2px solid var(--ink); border-radius: 6px; box-shadow: 5px 5px 0 var(--ink); }
[data-dir="hometown"] .card-hover:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--ink); }

/* ========== PILLS / BADGES ========== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-soft); color: var(--red-deep);
  padding: 5px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
}
.pill-cream { background: var(--parchment); color: var(--ink-mid); }
.pill-sky { background: var(--sky-pale); color: #0F5A85; }
.pill-royal { background: var(--royal-pale); color: var(--royal-deep); }
.pill-navy { background: var(--royal); color: #fff; }
.pill-gold { background: #FDF4D3; color: #7C5E08; }
.pill-green { background: #DCFCE7; color: #15803D; }

/* ========== FORMS ========== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-body); font-weight: 700;
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-mid);
}
.field label .req { color: var(--red); margin-left: 2px; }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 16px;
  color: var(--ink); background: var(--white);
  border: 1.5px solid var(--rule-dk);
  border-radius: 4px;
  padding: 12px 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229,30,37,.14);
}
.field textarea { resize: vertical; min-height: 120px; }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.field-row.single { grid-template-columns: 1fr; }
.field-row.three { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 560px) { .field-row, .field-row.three { grid-template-columns: 1fr; } }

.field-hint { font-size: 12.5px; color: var(--ink-light); }
.field-error { font-size: 12.5px; color: var(--red-deep); display: none; }
.field-error.show { display: block; }

.info-box {
  background: var(--sky-pale);
  border-left: 3px solid var(--royal);
  padding: 14px 18px;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  color: var(--ink-mid);
  line-height: 1.5;
}
.warning-box {
  background: #FEF3C7;
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  color: #5B3E08;
  line-height: 1.5;
}

/* Checkbox / radio styling */
.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: 4px;
  background: var(--white); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.check-row:hover { border-color: var(--ink-mid); }
.check-row.selected { border-color: var(--red); background: var(--red-pale); }
.check-row input { margin-top: 3px; flex-shrink: 0; accent-color: var(--red); width: 18px; height: 18px; }
.check-row-body { flex: 1; }
.check-row-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.check-row-desc { font-size: 13px; color: var(--ink-mid); margin-top: 3px; line-height: 1.5; }

/* ========== EDITORIAL DIRECTION OVERRIDES ========== */
[data-dir="editorial"] body { background: #FAF8F3; }
[data-dir="editorial"] .section-title { font-family: Georgia, serif; font-weight: 700; letter-spacing: -0.01em; }
[data-dir="editorial"] .pub-header { background: #fff; }
[data-dir="editorial"] .pub-footer { background: var(--ink); }

/* ========== TWEAKS PANEL ========== */
#tweaks-panel {
  position: fixed; right: 20px; bottom: 20px;
  width: 320px; background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--sh-lg);
  padding: 20px; z-index: 200;
  font-family: var(--font-body);
  display: none;
}
#tweaks-panel.open { display: block; }
#tweaks-panel h3 {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 16px; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
#tweaks-panel h3::before { content: ""; width: 8px; height: 8px; background: var(--red); border-radius: 50%; }
#tweaks-panel .tg-section { margin-bottom: 18px; }
#tweaks-panel .tg-section:last-child { margin-bottom: 0; }
#tweaks-panel .tg-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--ink-light); margin-bottom: 8px;
}
#tweaks-panel .tg-options { display: flex; gap: 6px; flex-wrap: wrap; }
#tweaks-panel .tg-opt {
  padding: 7px 13px; font-size: 12.5px; font-weight: 600;
  border: 1.5px solid var(--rule-dk); border-radius: 3px;
  background: #fff; color: var(--ink-mid); cursor: pointer;
  font-family: var(--font-body);
}
#tweaks-panel .tg-opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }
#tweaks-panel .tg-opt:hover:not(.active) { border-color: var(--ink-mid); color: var(--ink); }

/* ========== IMAGE PLACEHOLDERS ========== */
.img-ph {
  background: linear-gradient(135deg, var(--parchment) 0%, var(--rule-dk) 100%);
  border: 1.5px dashed var(--rule-dk);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  color: var(--ink-light); font-size: 12px;
  text-align: center; padding: 20px;
  letter-spacing: .04em; text-transform: uppercase;
  min-height: 180px;
  position: relative; overflow: hidden;
}
.img-ph::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 14px, rgba(0,0,0,.025) 14px, rgba(0,0,0,.025) 15px);
  pointer-events: none;
}
.img-ph-label {
  font-weight: 700; font-family: var(--font-display);
  font-size: 13px; color: var(--ink-mid); letter-spacing: .08em;
}
.img-ph-caption {
  font-size: 11px; color: var(--ink-light);
  text-transform: none; letter-spacing: 0;
  max-width: 240px;
}

/* ========== FIREWORK MOTIF (from signage) ========== */
.fw-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(65,182,230,.35) 1.5px, transparent 2px),
    radial-gradient(circle at 90% 15%, rgba(65,182,230,.25) 1px, transparent 1.5px),
    radial-gradient(circle at 80% 80%, rgba(65,182,230,.30) 1.5px, transparent 2px),
    radial-gradient(circle at 20% 75%, rgba(65,182,230,.25) 1px, transparent 1.5px);
  background-size: 120px 120px;
}

/* ========== LINK TEXT UTILITIES ========== */
.u-link { color: var(--red-deep); font-weight: 600; }
.u-link:hover { text-decoration: underline; }
.u-mono { font-family: var(--font-mono); }
.u-italic { font-style: italic; }
.u-center { text-align: center; }
.u-mt-s { margin-top: 12px; }
.u-mt-m { margin-top: 24px; }
.u-mt-l { margin-top: 40px; }

/* ========== GRID UTILITIES ========== */
.g-2 { display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
.g-3 { display: grid; gap: 24px; grid-template-columns: repeat(3, 1fr); }
.g-4 { display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } }
