/* ==========================================================================
   Royal Custom Theme — Main Foundation
   Purpose: design tokens, reset, typography, layout primitives, buttons,
   forms, content pages, WordPress helpers. Header/footer/home are separate.
   ========================================================================== */

:root {
  color-scheme: light;

  --royal-white: #ffffff;
  --royal-black: #05070b;
  --royal-page: #f7f5ef;
  --royal-paper: #fffdf8;
  --royal-soft: #f0eee7;
  --royal-line: rgba(9, 24, 44, 0.12);

  --royal-ink: #162033;
  --royal-ink-soft: #2d384b;
  --royal-muted: #6d7482;

  --royal-navy-950: #04101f;
  --royal-navy-900: #07182f;
  --royal-navy: #0a2342;
  --royal-navy-700: #17385f;
  --royal-blue: #2d4373;

  --royal-gold-100: #fff1bf;
  --royal-gold-200: #f6dfa0;
  --royal-gold: #d4af37;
  --royal-gold-700: #ad8425;
  --royal-copper: #9b5f35;
  --royal-burgundy: #5e1746;

  --gradient-navy: linear-gradient(145deg, #04101f 0%, #07182f 44%, #0a2342 100%);
  --gradient-gold: linear-gradient(180deg, #fff0bf 0%, #d4af37 58%, #aa8428 100%);
  --gradient-soft: linear-gradient(180deg, #fffdf8 0%, #f7f5ef 100%);

  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-heading: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --type-body-size: clamp(1rem, 0.94rem + 0.22vw, 1.125rem);
  --type-body-line: 1.68;
  --type-body-track: -0.008em;
  --type-small-size: 0.9rem;
  --type-small-line: 1.45;
  --type-eyebrow-size: clamp(0.72rem, 0.68rem + 0.1vw, 0.78rem);
  --type-eyebrow-track: 0.18em;
  --type-h1: clamp(3.15rem, 7.3vw, 7rem);
  --type-h2: clamp(2rem, 4.2vw, 4.4rem);
  --type-h3: clamp(1.35rem, 2.4vw, 2rem);

  --container: 1280px;
  --container-wide: 1480px;
  --content: 820px;
  --gutter: clamp(1rem, 3vw, 2.25rem);
  --section-space: clamp(4.25rem, 8vw, 8rem);

  --radius-sm: 0.625rem;
  --radius-md: 1rem;
  --radius-lg: 1.35rem;
  --radius-xl: 1.75rem;
  --radius-2xl: 2.5rem;
  --radius-pill: 999px;

  --shadow-soft: 0 18px 48px rgba(7, 24, 47, 0.12);
  --shadow-strong: 0 28px 90px rgba(7, 24, 47, 0.28);
  --focus: 0 0 0 4px rgba(212, 175, 55, 0.35);

  --duration-fast: 180ms;
  --duration: 260ms;
  --duration-slow: 700ms;
  --ease-standard: cubic-bezier(0.2, 0.72, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--royal-navy-950);
}

body {
  margin: 0;
  background: var(--royal-page);
  color: var(--royal-ink);
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  letter-spacing: var(--type-body-track);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.site-menu-open {
  overflow: hidden;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: var(--royal-blue);
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--royal-burgundy);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

::selection {
  background: var(--royal-gold);
  color: var(--royal-navy-950);
}

.screen-reader-text,
.skip-link:not(:focus) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10000;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--royal-gold);
  color: var(--royal-navy-950);
  font-weight: 900;
  text-decoration: none;
}

.container,
.rhf-container {
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.container--wide,
.rhf-container--wide {
  width: min(100% - (var(--gutter) * 2), var(--container-wide));
  margin-inline: auto;
}

.container--content,
.rhf-container--content {
  width: min(100% - (var(--gutter) * 2), var(--content));
  margin-inline: auto;
}

.site-main {
  min-height: 52vh;
  background: var(--royal-page);
}

.has-cinematic-home .site-main {
  background: var(--royal-navy-950);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: inherit;
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

h1 { font-size: var(--type-h1); }
h2 { font-size: var(--type-h2); }
h3 { font-size: var(--type-h3); }

p {
  text-wrap: pretty;
}

.royal-kicker,
.rhf-eyebrow,
.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--royal-gold-200);
  font-family: var(--font-body);
  font-size: var(--type-eyebrow-size);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: var(--type-eyebrow-track);
  text-transform: uppercase;
}

.button,
.rhf-button,
input[type="submit"],
button[type="submit"],
.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.9rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}

.button:hover,
.rhf-button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover,
.search-submit:hover {
  transform: translateY(-1px);
}

.button--gold,
.rhf-button--gold {
  color: var(--royal-navy-950);
  border-color: rgba(255, 238, 184, 0.72);
  background: var(--gradient-gold);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 16px 34px rgba(212, 175, 55, 0.22);
}

.button--gold:hover,
.rhf-button--gold:hover {
  color: var(--royal-navy-950);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 20px 46px rgba(212, 175, 55, 0.3);
}

.button--dark,
.rhf-button--dark {
  color: var(--royal-white);
  background: var(--royal-navy-950);
  box-shadow: 0 16px 34px rgba(7, 24, 47, 0.24);
}

.button--dark:hover,
.rhf-button--dark:hover {
  color: var(--royal-white);
  background: var(--royal-navy);
}

.button--outline-light,
.rhf-button--ghost-light,
.button--outline,
.rhf-button--outline {
  color: var(--royal-white);
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.button--outline-light:hover,
.rhf-button--ghost-light:hover,
.button--outline:hover,
.rhf-button--outline:hover {
  color: var(--royal-white);
  border-color: rgba(246, 223, 160, 0.68);
  background: rgba(255, 255, 255, 0.14);
}

.button--outline-dark,
.rhf-button--outline-dark {
  color: var(--royal-navy);
  border-color: rgba(10, 35, 66, 0.22);
  background: rgba(255, 255, 255, 0.68);
}

.button--outline-dark:hover,
.rhf-button--outline-dark:hover {
  color: var(--royal-white);
  border-color: var(--royal-navy);
  background: var(--royal-navy);
}

.search-form {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.search-field,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
textarea,
select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid rgba(10, 35, 66, 0.16);
  border-radius: var(--radius-md);
  background: var(--royal-white);
  color: var(--royal-ink);
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

.page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(7rem, 12vw, 10rem) 0 clamp(4rem, 8vw, 7rem);
  color: var(--royal-white);
  background:
    radial-gradient(circle at 85% 10%, rgba(212, 175, 55, 0.15), transparent 24rem),
    radial-gradient(circle at 10% 80%, rgba(255, 255, 255, 0.08), transparent 22rem),
    var(--gradient-navy);
}

.page-hero h1 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
}

.archive-description,
.entry-meta,
.page-hero p {
  color: rgba(255,255,255,0.78);
}

.content-section,
.rhf-section {
  padding: var(--section-space) 0;
  background: var(--royal-page);
}

.page-content,
.entry-content {
  width: min(100% - (var(--gutter) * 2), var(--content));
  margin-inline: auto;
  color: var(--royal-ink-soft);
}

.page-content > *:first-child,
.entry-content > *:first-child { margin-top: 0; }
.page-content > *:last-child,
.entry-content > *:last-child { margin-bottom: 0; }

.page-content h2,
.page-content h3,
.page-content h4,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 2.2em 0 0.7em;
  color: var(--royal-navy);
}

.page-content h2,
.entry-content h2 { font-size: clamp(1.9rem, 3.4vw, 3rem); }
.page-content h3,
.entry-content h3 { font-size: clamp(1.35rem, 2.2vw, 2rem); }

.page-content img,
.entry-content img,
.entry-image {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.page-content blockquote,
.entry-content blockquote {
  margin: 2rem 0;
  padding: 1.35rem 1.5rem;
  border-left: 4px solid var(--royal-gold);
  border-radius: var(--radius-md);
  background: var(--royal-paper);
  box-shadow: var(--shadow-soft);
}

.post-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.content-card,
.empty-state {
  overflow: hidden;
  border: 1px solid rgba(10, 35, 66, 0.08);
  border-radius: var(--radius-lg);
  background: var(--royal-paper);
  box-shadow: var(--shadow-soft);
}

.content-card__image img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.content-card__body,
.empty-state {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.content-card__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.content-card__title a {
  color: var(--royal-navy);
  text-decoration: none;
}

.empty-state {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.alignwide {
  width: min(100%, var(--container));
  max-width: var(--container);
  margin-inline: auto;
}

.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.wp-caption { max-width: 100%; }
.wp-caption-text,
.gallery-caption { color: var(--royal-muted); font-size: 0.92rem; }
.sticky,
.bypostauthor { scroll-margin-top: 8rem; }

@media (max-width: 980px) {
  .post-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    line-height: 1.6;
  }

  .search-form {
    flex-direction: column;
  }

  .button,
  .rhf-button,
  .search-submit {
    width: 100%;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .page-hero {
    padding-top: 6.5rem;
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
