/* Self-hosted fonts */

/* Source Serif 4 - Display serif (regular) */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/source-serif-4-400.woff2') format('woff2');
}

/* Source Serif 4 - Display serif (semibold) */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/source-serif-4-600.woff2') format('woff2');
}

/* Source Serif 4 - Display serif (italic) */
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/source-serif-4-400i.woff2') format('woff2');
}

/* Public Sans - UI sans (regular) */
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/public-sans-400.woff2') format('woff2');
}

/* Public Sans - UI sans (semibold) */
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/public-sans-600.woff2') format('woff2');
}

/* Public Sans - UI sans (bold) */
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/public-sans-700.woff2') format('woff2');
}

/* ============================================================================
   DESIGN TOKENS: Dark theme defaults
   ============================================================================ */

:root {
  /* Dark theme colors (defaults) */
  --ground: #101720;
  --panel: #223042;
  --ink: #F2EEE2;
  --body: #A9A496;
  --gold: #D9A441;
  --hair: rgba(217, 164, 65, 0.15);
  --scrim: linear-gradient(180deg, rgba(16, 23, 32, 0) 0%, rgba(16, 23, 32, 0.85) 100%);
  --scrim-reverse: linear-gradient(180deg, rgba(16, 23, 32, 0.85) 0%, rgba(16, 23, 32, 0) 100%);

  /* Typography */
  --display-serif: 'Source Serif 4', 'Georgia', serif;
  --ui-sans: 'Public Sans', 'Segoe UI', sans-serif;

  /* Spacing & layout */
  --gap-xs: 0.5rem;
  --gap-sm: 1rem;
  --gap-md: 1.5rem;
  --gap-lg: 2rem;
  --gap-xl: 3rem;
  --gap-2xl: 4rem;

  /* Transitions */
  --transition: all 0.3s ease;
}

/* Light theme overrides */
@media (prefers-color-scheme: light) {
  :root {
    --ground: #F4F3EF;
    --panel: #FFFFFF;
    --ink: #16202C;
    --body: #6B6660;
    --gold: #A87E2B;
    --hair: rgba(168, 126, 43, 0.1);
    --scrim: linear-gradient(180deg, rgba(244, 243, 239, 0) 0%, rgba(244, 243, 239, 0.9) 100%);
    --scrim-reverse: linear-gradient(180deg, rgba(244, 243, 239, 0.9) 0%, rgba(244, 243, 239, 0) 100%);
  }
}

/* Manual dark theme override (data-theme attribute) */
:root[data-theme="dark"] {
  --ground: #101720;
  --panel: #223042;
  --ink: #F2EEE2;
  --body: #A9A496;
  --gold: #D9A441;
  --hair: rgba(217, 164, 65, 0.15);
  --scrim: linear-gradient(180deg, rgba(16, 23, 32, 0) 0%, rgba(16, 23, 32, 0.85) 100%);
  --scrim-reverse: linear-gradient(180deg, rgba(16, 23, 32, 0.85) 0%, rgba(16, 23, 32, 0) 100%);
}

/* Manual light theme override (data-theme attribute) */
:root[data-theme="light"] {
  --ground: #F4F3EF;
  --panel: #FFFFFF;
  --ink: #16202C;
  --body: #6B6660;
  --gold: #A87E2B;
  --hair: rgba(168, 126, 43, 0.1);
  --scrim: linear-gradient(180deg, rgba(244, 243, 239, 0) 0%, rgba(244, 243, 239, 0.9) 100%);
  --scrim-reverse: linear-gradient(180deg, rgba(244, 243, 239, 0.9) 0%, rgba(244, 243, 239, 0) 100%);
}

/* ============================================================================
   GLOBAL RESET & BASE STYLES
   ============================================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--ui-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--ground);
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

/* Respect user's reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display-serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: var(--gap-md);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.8rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--gap-md);
  color: var(--body);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* Italic emphasis for display serif (optional gold em in headlines) */
em {
  font-style: italic;
  color: var(--gold);
}

strong {
  font-weight: 600;
  color: var(--ink);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

@media (max-width: 768px) {
  .wrap {
    padding: 0 clamp(20px, 4vw, 48px);
  }
}

/* Kicker: uppercase gold letter-spaced label */
.kicker {
  font-family: var(--ui-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: var(--gap-sm);
  display: block;
}

/* Gold outlined button */
.btn-gold {
  display: inline-block;
  padding: 0.875rem 2rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--ui-sans);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  background-color: transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-gold:hover {
  background-color: var(--gold);
  color: var(--ground);
}

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

/* Hairline rule */
.rule {
  border: none;
  border-top: 1px solid var(--hair);
  margin: var(--gap-lg) 0;
}

/* Grid utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--gap-lg);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Photo treatment with scrim overlay */
.photo-scrim {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.photo-scrim img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-scrim::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(16, 23, 32, 0.15) 100%);
  pointer-events: none;
}

@media (prefers-color-scheme: light) {
  .photo-scrim::after {
    background: linear-gradient(180deg, transparent 0%, rgba(244, 243, 239, 0.15) 100%);
  }
}

:root[data-theme="light"] .photo-scrim::after {
  background: linear-gradient(180deg, transparent 0%, rgba(244, 243, 239, 0.15) 100%);
}

/* Reveal animation for scroll reveals.
   Flicker-free contract: without JS (no .js on <html>) everything is visible.
   With JS, .reveal is hidden from FIRST PAINT (the .js class is added by a
   synchronous inline script in <head>), and the animation's `both` fill keeps
   it hidden through its stagger delay, so each element paints exactly once. */
.reveal {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
  }

  .js .reveal.in-view {
    animation: revealUp 0.6s ease both;
  }
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
  }
  .reveal.in-view {
    animation: none;
  }
}

/* Load-time animations for hero and content */
@keyframes fadeUpKicker {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUpHeadline {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUpSub {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUpCta {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Hero load sequence - staggered fade-up */
.hero-section .kicker {
  animation: fadeUpKicker 0.6s ease both;
}

.hero-section h1 {
  animation: fadeUpHeadline 0.6s ease 0.08s both;
}

.hero-section .hero-subline {
  animation: fadeUpSub 0.6s ease 0.16s both;
}

.hero-section .btn-gold {
  animation: fadeUpCta 0.6s ease 0.24s both;
}

.hero-image img {
  animation: fadeIn 0.6s ease 0.08s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-section .kicker,
  .hero-section h1,
  .hero-section .hero-subline,
  .hero-section .btn-gold,
  .hero-image img {
    animation: none;
  }
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--ground);
  border-bottom: 1px solid var(--hair);
  padding: var(--gap-md) 0;
  transition: background-color var(--transition), border-color var(--transition);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .nav-content {
    padding: 0 var(--gap-md);
  }
}

.nav-brand {
  font-family: var(--display-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: var(--gap-lg);
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: var(--panel);
    padding: var(--gap-md);
    gap: var(--gap-sm);
    border-bottom: 1px solid var(--hair);
    z-index: 999;
  }

  .nav-links.active {
    display: flex;
  }
}

.nav-links a {
  font-family: var(--ui-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-links a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.nav-links a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--hair);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--body);
  transition: all var(--transition);
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Hamburger menu toggle (mobile) */
.hamburger {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  gap: 5px;
  padding: 0;
}

@media (max-width: 760px) {
  .hamburger {
    display: flex;
  }
}

.hamburger span {
  width: 24px;
  height: 2px;
  background-color: var(--ink);
  transition: all var(--transition);
  border-radius: 1px;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
  background-color: var(--panel);
  border-top: 1px solid var(--hair);
  padding: var(--gap-2xl) 0;
  margin-top: var(--gap-2xl);
  transition: background-color var(--transition), border-color var(--transition);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-xl);
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    padding: 0 var(--gap-md);
  }
}

.footer-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: var(--gap-md);
}

.footer-section p {
  font-size: 0.95rem;
  line-height: 1.8;
}

/* Social links */
.social-links {
  display: flex;
  gap: var(--gap-md);
  margin: var(--gap-md) 0;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--hair);
  border-radius: 50%;
  color: var(--gold);
  transition: all var(--transition);
}

.social-links a:hover {
  border-color: var(--gold);
  background-color: var(--gold);
  color: var(--ground);
}

.social-links svg {
  width: 20px;
  height: 20px;
}

/* Credit line */
.footer-credit {
  grid-column: 1 / -1;
  padding-top: var(--gap-lg);
  border-top: 1px solid var(--hair);
  text-align: center;
  font-size: 0.85rem;
  color: var(--body);
}

.footer-credit a {
  color: var(--gold);
}

.footer-credit a:hover {
  color: var(--ink);
}

/* ============================================================================
   SECTIONS & CONTENT BLOCKS
   ============================================================================ */

section {
  padding: var(--gap-2xl) 0;
}

.hero {
  padding: var(--gap-2xl) 0;
  display: flex;
  align-items: center;
  gap: var(--gap-xl);
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    padding: var(--gap-xl) 0;
  }
}

.hero-content {
  flex: 1;
}

.hero-image {
  flex: 1;
  overflow: hidden;
  border-radius: 0;
}

.hero-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Cards */
.card {
  background-color: var(--panel);
  padding: var(--gap-lg);
  border: 1px solid var(--hair);
  border-radius: 8px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.card-title {
  font-family: var(--display-serif);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: var(--gap-md);
}

.card-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--body);
}

/* ============================================================================
   FORMS
   ============================================================================ */

form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

input,
textarea {
  font-family: var(--ui-sans);
  font-size: 1rem;
  padding: 0.875rem;
  border: 1px solid var(--hair);
  background-color: var(--panel);
  color: var(--ink);
  transition: all var(--transition);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--body);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================================================
   RESPONSIVE MEDIA
   ============================================================================ */

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

/* Guard against horizontal scroll on images */
figure {
  margin: 0;
  overflow: hidden;
}

figure img {
  width: 100%;
  height: auto;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  .nav,
  .footer,
  .theme-toggle,
  .hamburger {
    display: none;
  }
}
