/* ===== Design Tokens ===== */
:root {
  /* Colors */
  --color-ocean-blue: #0A2E4D;
  --color-ivory: #F5F0E6;
  --color-navy: #1C3A5A;
  --color-brass: #BFA05A;
  --color-deep-ivory: #EAE3D5;
  --color-text-primary: #1A1A1A;
  --color-text-on-dark: #F5F0E6;
  --color-link-brass: #8C6D3F;
  --color-border-light: #D6CBB8;
  --color-overlay-dark: rgba(10, 46, 77, 0.6);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans Pro', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

  /* Type Scale */
  --text-display: clamp(2.5rem, 5vw, 3.5rem); /* 56px */
  --text-h1: clamp(2rem, 4vw, 2.5rem); /* 40px */
  --text-h2: clamp(1.75rem, 3vw, 2rem); /* 32px */
  --text-h3: clamp(1.375rem, 2.5vw, 1.5rem); /* 24px */
  --text-h4: clamp(1.125rem, 2vw, 1.25rem); /* 20px */
  --text-body-large: 1.125rem; /* 18px */
  --text-body: 1rem; /* 16px */
  --text-caption: 0.875rem; /* 14px */

  /* Line Heights */
  --leading-display: 1.1;
  --leading-h1: 1.2;
  --leading-h2: 1.3;
  --leading-h3: 1.4;
  --leading-h4: 1.4;
  --leading-body-large: 1.6;
  --leading-body: 1.6;
  --leading-caption: 1.5;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  --space-9: 128px;

  /* Containers */
  --container-max: 1200px;
  --container-padding-mobile: 24px;
  --container-padding-desktop: 48px;
  --section-spacing-mobile: 24px;
  --section-spacing-desktop: 64px;

  /* Surfaces */
  --surface-primary: var(--color-ivory);
  --surface-secondary: var(--color-deep-ivory);
  --surface-dark: var(--color-ocean-blue);
  --surface-dark-alt: var(--color-navy);
  --card-padding: 24px;

  /* Borders & Shadows */
  --border-width: 1px;
  --border-style: solid;
  --border-color: var(--color-border-light);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.05);

  /* Corner Radius */
  --radius-none: 0px;
  --radius-card: 4px;
  --radius-button: 8px;
  --radius-circle: 50%;

  /* Transitions */
  --transition-fast: 0.2s ease;

  /* Touch Targets */
  --touch-target-min: 44px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: 400;
  color: var(--color-text-primary);
  background-color: var(--surface-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: var(--color-link-brass);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-brass);
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

blockquote,
q {
  quotes: none;
}

blockquote::before,
blockquote::after,
q::before,
q::after {
  content: '';
  content: none;
}

/* ===== Document Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-navy);
  line-height: var(--leading-h2);
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-h1);
  margin-block-end: var(--space-4);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  margin-block-end: var(--space-4);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  margin-block-end: var(--space-3);
}

h4 {
  font-size: var(--text-h4);
  line-height: var(--leading-h4);
  margin-block-end: var(--space-3);
}

h5,
h6 {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: var(--space-2);
}

p {
  margin-block-end: var(--space-4);
  line-height: var(--leading-body);
}

p:last-child {
  margin-block-end: 0;
}

strong,
b {
  font-weight: 700;
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
}

/* ===== Lists ===== */
ul,
ol {
  margin-block-end: var(--space-4);
  padding-inline-start: var(--space-4);
}

ul {
  list-style: disc;
}

ol {
  list-style: decimal;
}

li {
  line-height: var(--leading-body);
}

/* Content list spacing scoped to avoid affecting flex/grid lists */
.content-list > li,
article li,
main li {
  margin-block-end: var(--space-2);
}

.content-list > li:last-child,
article li:last-child,
main li:last-child {
  margin-block-end: 0;
}

/* ===== Blockquotes ===== */
blockquote {
  margin-block-end: var(--space-4);
  padding-inline-start: var(--space-4);
  border-inline-start: 3px solid var(--color-brass);
  color: var(--color-navy);
  font-style: italic;
}

blockquote p {
  margin-block-end: var(--space-2);
}

blockquote p:last-child {
  margin-block-end: 0;
}

/* ===== Media ===== */
figure {
  margin-block-end: var(--space-4);
}

figcaption {
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  color: var(--color-navy);
  margin-block-start: var(--space-2);
}

/* ===== Forms ===== */
label {
  display: block;
  margin-block-end: var(--space-2);
  font-weight: 600;
  color: var(--color-navy);
}

input,
select,
textarea {
  width: 100%;
  padding: var(--space-3);
  border: var(--border-width) var(--border-style) var(--border-color);
  border-radius: var(--radius-button);
  background-color: var(--surface-primary);
  color: var(--color-text-primary);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: var(--touch-target-min);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-brass);
  outline-offset: 1px;
  border-color: var(--color-brass);
}

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

select {
  appearance: auto;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  margin-inline-end: var(--space-2);
}

input[type="submit"],
input[type="button"],
input[type="reset"] {
  width: auto;
  cursor: pointer;
}

fieldset {
  border: var(--border-width) var(--border-style) var(--border-color);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  margin-block-end: var(--space-4);
}

legend {
  padding: 0 var(--space-2);
  font-weight: 600;
  color: var(--color-navy);
}

/* ===== Containers ===== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-mobile);
}

.container--wide {
  max-width: 1400px;
}

/* ===== Sections ===== */
.section {
  padding-block: var(--section-spacing-mobile);
}

.section--dark {
  background-color: var(--surface-dark);
  color: var(--color-text-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--color-text-on-dark);
}

.section--dark-alt {
  background-color: var(--surface-dark-alt);
  color: var(--color-text-on-dark);
}

.section--dark-alt h1,
.section--dark-alt h2,
.section--dark-alt h3,
.section--dark-alt h4,
.section--dark-alt h5,
.section--dark-alt h6 {
  color: var(--color-text-on-dark);
}

.section--deep-ivory {
  background-color: var(--surface-secondary);
}

/* ===== Surfaces ===== */
.surface-card {
  background-color: var(--surface-primary);
  border: var(--border-width) var(--border-style) var(--border-color);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
  box-shadow: var(--shadow-card);
}

.surface-card--deep-ivory {
  background-color: var(--surface-secondary);
}

.surface-card--dark {
  background-color: var(--surface-dark);
  color: var(--color-text-on-dark);
  border-color: transparent;
}

.surface-card--dark h1,
.surface-card--dark h2,
.surface-card--dark h3,
.surface-card--dark h4,
.surface-card--dark h5,
.surface-card--dark h6 {
  color: var(--color-text-on-dark);
}

.surface-card--dark-alt {
  background-color: var(--surface-dark-alt);
  color: var(--color-text-on-dark);
  border-color: transparent;
}

.surface-card--dark-alt h1,
.surface-card--dark-alt h2,
.surface-card--dark-alt h3,
.surface-card--dark-alt h4,
.surface-card--dark-alt h5,
.surface-card--dark-alt h6 {
  color: var(--color-text-on-dark);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-target-min);
  border-radius: var(--radius-button);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 700;
  line-height: var(--leading-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
  border: var(--border-width) var(--border-style) transparent;
}

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

.btn--primary {
  background-color: var(--color-brass);
  color: var(--color-navy);
  border-color: var(--color-brass);
}

.btn--primary:hover {
  background-color: var(--color-navy);
  color: var(--color-brass);
  border-color: var(--color-navy);
  text-decoration: none;
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-brass);
  border-color: var(--color-brass);
}

.btn--secondary:hover {
  background-color: var(--color-brass);
  color: var(--color-navy);
  text-decoration: none;
}

.btn--dark {
  background-color: var(--color-navy);
  color: var(--color-text-on-dark);
  border-color: var(--color-navy);
}

.btn--dark:hover {
  background-color: var(--color-ocean-blue);
  color: var(--color-text-on-dark);
  border-color: var(--color-ocean-blue);
  text-decoration: none;
}

.btn--light {
  background-color: var(--surface-primary);
  color: var(--color-navy);
  border-color: var(--surface-primary);
}

.btn--light:hover {
  background-color: var(--color-deep-ivory);
  color: var(--color-navy);
  border-color: var(--color-deep-ivory);
  text-decoration: none;
}

.btn--small {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-caption);
  min-height: 36px;
}

.btn--large {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-body-large);
  min-height: 52px;
}

/* ===== Links ===== */
.link-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-underline:hover {
  text-decoration-color: var(--color-brass);
}

/* ===== Overline ===== */
.overline {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-brass);
  margin-block-end: var(--space-2);
}

/* ===== Flex Utilities ===== */
.flex {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.flex > * {
  min-width: 0;
  flex-shrink: 1;
}

.flex--nowrap {
  flex-wrap: nowrap;
}

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

.flex--align-center {
  align-items: center;
}

.flex--align-start {
  align-items: flex-start;
}

.flex--align-end {
  align-items: flex-end;
}

.flex--justify-center {
  justify-content: center;
}

.flex--justify-start {
  justify-content: flex-start;
}

.flex--justify-end {
  justify-content: flex-end;
}

.flex--justify-between {
  justify-content: space-between;
}

.flex--gap-none {
  gap: 0;
}

.flex--gap-small {
  gap: var(--space-2);
}

.flex--gap-medium {
  gap: var(--space-4);
}

.flex--gap-large {
  gap: var(--space-5);
}

/* ===== Grid Utility (Self-contained) ===== */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid > * {
  min-width: 0;
  flex-shrink: 1;
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid--gap-none {
  gap: 0;
}

.grid--gap-small {
  gap: var(--space-2);
}

.grid--gap-medium {
  gap: var(--space-3);
}

.grid--gap-large {
  gap: var(--space-5);
}

/* ===== Image Overlay ===== */
.image-overlay {
  position: relative;
}

.image-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--color-overlay-dark);
  pointer-events: none;
}

.image-overlay > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Responsive Adjustments ===== */
@media (min-width: 768px) {
  .container {
    padding-inline: var(--container-padding-desktop);
  }

  .section {
    padding-block: var(--section-spacing-desktop);
  }

  .section--spacing-large {
    padding-block: var(--space-8);
  }
}

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

  .flex--stack-mobile {
    flex-direction: column;
  }

  .flex--stack-mobile > * {
    width: 100%;
  }
}

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

/* ===== Focus Visibility ===== */
:focus-visible {
  outline: 2px solid var(--color-brass);
  outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
  background-color: var(--color-brass);
  color: var(--color-navy);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-deep-ivory);
}

::-webkit-scrollbar-thumb {
  background: var(--color-navy);
  border-radius: var(--radius-button);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-brass);
}

/* ===== Utility: Visually Hidden ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Utility: Text Alignment ===== */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* ===== Utility: Display ===== */
.display-heading {
  font-family: var(--font-heading);
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-navy);
  margin-block-end: var(--space-4);
}

.section--dark .display-heading,
.section--dark-alt .display-heading {
  color: var(--color-text-on-dark);
}

/* ===== Utility: Body Large ===== */
.body-large {
  font-size: var(--text-body-large);
  line-height: var(--leading-body-large);
}

/* ===== Utility: Caption ===== */
.caption {
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
}