:root {
  --color-primary: #FFB347;
  --color-secondary: #FF8C00;
  --color-accent: #FFB347;
  --color-on-primary: #ffffff;
  --color-on-secondary: #ffffff;
  --color-on-accent: #ffffff;
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-text: #333333;
  --color-text-secondary: #666666;
  --color-error: #EF4444;
  --color-success: #10B981;
  --font-heading: 'Playfair Display', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --radius: 0.5rem;
  --shadow: none;
  --max-width: 1200px;
}

body[data-pack] {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

:where(body[data-pack]) :where(*, *::before, *::after) {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:where(body[data-pack]) a {
  color: var(--color-primary);
  text-decoration: none;
}
:where(body[data-pack]) a:hover {
  text-decoration: underline;
}

:where(body[data-pack]) .btn:focus-visible,
:where(body[data-pack]) a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

:where(body[data-pack]) input:focus-visible,
:where(body[data-pack]) textarea:focus-visible,
:where(body[data-pack]) select:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}


:where([data-pack]) :where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-heading);
  line-height: 1.2;
}

:where([data-pack]) .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Per-section body typography + max-width (CSS vars from SectionShell) ── */
/* The vars are set on each <section> by SectionShell; these rules apply them
   to <p> descendants and the .container. Zero specificity via :where() so any
   inline style or class rule still wins. */
:where([data-pack]) section {
  --body-font-size: initial;
  --body-line-height: initial;
  --body-font-weight: initial;
  --body-letter-spacing: initial;
  --body-font-family: initial;
  --section-max-width: initial;
}
:where([data-pack]) section :where(p, .body) {
  font-size: var(--body-font-size);
  line-height: var(--body-line-height);
  font-weight: var(--body-font-weight);
  letter-spacing: var(--body-letter-spacing);
  font-family: var(--body-font-family);
}
:where([data-pack]) section .container {
  max-width: var(--section-max-width, var(--max-width));
}

/* ── Data-owned section box overrides ──────────────────────────
   Style packs are allowed to use !important for their defaults, but section
   data is the source of truth once present. These selectors intentionally use
   higher specificity than pack selectors like [data-pack="x"] section while
   remaining inert unless composeSectionStyle emitted the matching data marker. */
[data-pack] section[data-tynto-section-padding][data-tynto-section-padding] {
  padding: var(--tynto-section-padding) !important;
}
[data-pack] section[data-tynto-section-background][data-tynto-section-background] {
  /* background-COLOR, not the background shorthand: the shorthand resets
     background-image to none, which erased the hero's background photo on any
     section carrying BOTH a background color and an image (green-hero bug,
     2026-07-26). The --tynto-section-background var is always a color, so
     forcing just the color preserves the inline background-image layer. */
  background-color: var(--tynto-section-background) !important;
}
[data-pack] section[data-tynto-section-color][data-tynto-section-color] {
  color: var(--tynto-section-color) !important;
}
[data-pack] section[data-tynto-section-border-radius][data-tynto-section-border-radius] {
  border-radius: var(--tynto-section-border-radius) !important;
}
[data-pack] section[data-tynto-section-box-shadow][data-tynto-section-box-shadow] {
  box-shadow: var(--tynto-section-box-shadow) !important;
}
[data-pack] section[data-tynto-section-border][data-tynto-section-border] {
  border: var(--tynto-section-border) !important;
}
[data-pack] img[data-tynto-image-radius][data-tynto-image-radius] {
  border-radius: var(--tynto-image-radius) !important;
}
[data-pack] .btn[data-tynto-button-style][data-tynto-button-style] {
  background: var(--tynto-button-background) !important;
  border: var(--tynto-button-border) !important;
  border-radius: var(--tynto-button-border-radius) !important;
  color: var(--tynto-button-color) !important;
  padding: var(--tynto-button-padding) !important;
  text-decoration: var(--tynto-button-text-decoration) !important;
}
[data-pack] .btn[data-tynto-button-chrome][data-tynto-button-chrome] {
  background: var(--tynto-button-background) !important;
  border-color: var(--tynto-button-border-color) !important;
  color: var(--tynto-button-color) !important;
}

/* ── Per-section animation ── */
:where([data-pack]) section[data-animate="fade-up"] {
  animation: tynto-fade-up 0.6s ease-out both;
}
:where([data-pack]) section[data-animate="slide-in"] {
  animation: tynto-slide-in 0.6s ease-out both;
}
:where([data-pack]) section[data-animate="fade"] {
  animation: tynto-fade 0.6s ease-out both;
}
@keyframes tynto-fade-up {
  from { opacity: 0; transform: translateY(1.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tynto-slide-in {
  from { opacity: 0; transform: translateX(-1.5rem); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes tynto-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  :where([data-pack]) section[data-animate] { animation: none !important; }
}

:where([data-pack]) .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: opacity 0.2s;
}

:where([data-pack]) .btn:hover { opacity: 0.9; }

:where([data-pack]) .btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

:where([data-pack]) .btn-secondary {
  background: var(--color-secondary);
  color: var(--color-on-secondary);
}

:where([data-pack]) .btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

:where([data-pack]) .skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 0.5rem 1rem;
  z-index: 100;
  font-size: 0.875rem;
  transition: top 0.2s;
}
:where([data-pack]) .skip-link:focus {
  top: 0;
}

:where([data-pack]) img { max-width: 100%; height: auto; }

:where([data-pack]) nav[data-tynto-nav] a:hover {
  color: var(--color-primary);
  transition: color 120ms ease;
}

/* ── Hero gallery animations ───────── */

:where([data-pack]) .hero-heading {
  /* #167: the heading size is the pack's value ('--hero-heading-size', set
     per pack) multiplied by the section's relative 'heading_size' scale
     ('--heading-scale-override', emitted from layout.typography). With no
     scale set the multiplier is 1. An ABSOLUTE font_size (BaseStyle) still
     wins via the inline style on the h1. Lockstep w/ renderer html.rs. */
  font-size: calc(var(--hero-heading-size, clamp(2rem, 5vw, 4rem)) * var(--heading-scale-override, 1));
  margin-bottom: 0.5rem;
}

:where([data-pack]) .hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.9;
}

:where([data-pack]) .hero-gallery .hg-track,
:where([data-pack]) .hero-gallery .hg-overlay {
  position: absolute; inset: 0;
}
:where([data-pack]) .hero-gallery .hg-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

:where([data-pack]) .hero-gallery[data-transition="marquee"] .hg-track {
  display: flex;
  width: max-content;
  animation: hg-marquee 40s linear infinite;
}
:where([data-pack]) .hero-gallery[data-transition="marquee"] .hg-img {
  position: relative; inset: auto;
  flex: 0 0 auto;
  width: 38vw; max-width: 600px;
  height: 100%;
  margin-right: 1rem;
}
@keyframes hg-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

:where([data-pack]) .hero-gallery[data-transition="crossfade"] .hg-img {
  opacity: 0;
  animation: hg-crossfade calc(var(--n) * 6s) ease-in-out infinite;
  animation-delay: calc(var(--i) * 6s);
}
@keyframes hg-crossfade {
  0%        { opacity: 0; }
  4%, 28%   { opacity: 1; }
  36%, 100% { opacity: 0; }
}

:where([data-pack]) .hero-gallery[data-transition="slide"] .hg-img {
  opacity: 0;
  transform: translateX(100%);
  animation: hg-slide calc(var(--n) * 6s) cubic-bezier(0.7, 0, 0.3, 1) infinite;
  animation-delay: calc(var(--i) * 6s);
}
@keyframes hg-slide {
  0%        { opacity: 0; transform: translateX(100%); }
  4%, 28%   { opacity: 1; transform: translateX(0); }
  36%, 100% { opacity: 0; transform: translateX(-100%); }
}

:where([data-pack]) .hero-gallery[data-transition="ken-burns"] .hg-img {
  opacity: 0;
  transform: scale(1.05);
  animation: hg-kenburns calc(var(--n) * 8s) ease-in-out infinite;
  animation-delay: calc(var(--i) * 8s);
}
@keyframes hg-kenburns {
  0%        { opacity: 0; transform: scale(1.05) translate(0, 0); }
  4%        { opacity: 1; }
  28%       { opacity: 1; transform: scale(1.18) translate(-2%, -2%); }
  36%, 100% { opacity: 0; transform: scale(1.18) translate(-2%, -2%); }
}

@media (prefers-reduced-motion: reduce) {
  :where([data-pack]) .hero-gallery .hg-img { animation: none !important; }
  :where([data-pack]) .hero-gallery .hg-img:not(:first-of-type) { display: none; }
}

@media (max-width: 768px) {
  :where([data-pack]) .container[style*="grid-template-columns"],
  :where([data-pack]) .container [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  :where([data-pack]) .nav-toggle { display: block !important; }
  :where([data-pack]) .nav-links {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: inherit;
    flex-direction: column;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-surface);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  :where([data-pack]) .nav-links.open {
    display: flex !important;
  }
}

:where([data-pack]) .carousel::-webkit-scrollbar { display: none; }

:where([data-pack]) .animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
:where([data-pack]) .animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Motion hover effects (layout.motion.hover) ─────────────── */
:where([data-pack]) .motion-hover-lift {
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}
:where([data-pack]) .motion-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}
:where([data-pack]) .motion-hover-zoom {
  transition: transform 0.3s ease-out;
}
:where([data-pack]) .motion-hover-zoom:hover {
  transform: scale(1.05);
}
:where([data-pack]) .motion-hover-glow {
  transition: box-shadow 0.3s ease-out;
}
:where([data-pack]) .motion-hover-glow:hover {
  box-shadow: 0 0 24px rgba(var(--color-primary-rgb, 0, 120, 215), 0.35);
}


/* ── Style pack: editorial ───────── */
/* PALETTE — cream/ink/oxblood. Pack overrides --color-* so the same
   site picked up by Editorial vs Brutalist looks unrelated, not just
   "different fonts". User-set theme colors get overridden when this
   pack is active; they can still tweak via the Colors tab and the
   :where() in their tab-set rules will out-specific these. */
[data-pack="editorial"] {
  --color-bg: #FBF8F4;
  --color-surface: transparent;
  --color-text: #1A1814;
  --color-text-secondary: #6B6358;
  --color-primary: #8B0E0E;
  --color-secondary: #5C4A3A;
  --color-accent: #C8A560;
  font-family: var(--font-body, 'Source Serif 4', Georgia, serif);
  background: #FBF8F4;
  color: #1A1814;
}
[data-pack="editorial"] h1, [data-pack="editorial"] h2,
[data-pack="editorial"] h3, [data-pack="editorial"] h4 {
  font-family: var(--font-heading, 'Source Serif 4', Georgia, serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
[data-pack="editorial"] .hero-heading {
  --hero-heading-size: clamp(3rem, 7.5vw, 6rem);
  font-weight: 400;
  font-style: italic;
}
[data-pack="editorial"] .hero-sub {
  font-style: italic;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  opacity: 0.7;
}
[data-pack="editorial"] .btn {
  background: transparent !important;
  color: #1A1814 !important;
  border: none;
  border-bottom: 1px solid currentColor;
  border-radius: 0 !important;
  padding: 0.35rem 0 !important;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.74rem;
  transition: letter-spacing 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none !important;
}
[data-pack="editorial"] .btn:hover { letter-spacing: 0.28em; }
[data-pack="editorial"] section { padding-top: 7rem !important; padding-bottom: 7rem !important; }
[data-pack="editorial"] section + section { border-top: 1px solid rgba(0,0,0,0.12); }
/* Drop-cap on text-block bodies — gives that lit-mag opening feel. */
[data-pack="editorial"] [style*="font-family: var(--font-body)"] p:first-of-type::first-letter,
[data-pack="editorial"] section p:first-of-type:first-line { font-variant: small-caps; }
/* Photo treatment — soft, contrast-pulled, slightly desaturated. */
[data-pack="editorial"] section img {
  filter: contrast(0.95) saturate(0.7) brightness(0.98);
}
/* Cards lose their surface; just hairline below + above them. */
[data-pack="editorial"] [style*="background: var(--color-surface)"] {
  background: transparent !important;
  border-top: 1px solid rgba(0,0,0,0.08) !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: none !important;
}
