/* ========================================
   Variables
   ======================================== */
:root {
  color-scheme: light;

  /* Colors - Medieval palette */
  --color-background: #f5efe3; /* parchment */
  --color-surface: #faf6ea; /* light parchment */
  --color-surface-2: #f0ead8; /* deeper parchment */
  --color-text: #2b2b2b; /* ink */
  --color-primary: #274690; /* royal blue */
  --color-primary-contrast: #ffffff;
  --color-accent: #8c1c13; /* crimson */
  --color-accent-contrast: #ffffff;
  --color-gold: #c9a227; /* antique gold */
  --color-steel: #5a6772; /* steel gray */

  --color-success: #2e7d32;
  --color-warning: #b7791f;
  --color-danger: #a4161a;

  /* Neutral grays */
  --gray-50:  #f8fafc;
  --gray-100: #f2f4f7;
  --gray-200: #e4e7eb;
  --gray-300: #cbd2d9;
  --gray-400: #9aa5b1;
  --gray-500: #7b8794;
  --gray-600: #616e7c;
  --gray-700: #52606d;
  --gray-800: #3e4c59;
  --gray-900: #323f4b;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-serif: "Garamond", "Palatino Linotype", "Palatino", "Times New Roman", Times, serif;
  --font-display: "Cinzel", "Trajan Pro", "Goudy Old Style", "Garamond", Georgia, serif;

  --font-size-100: 0.75rem;  /* 12px */
  --font-size-200: 0.875rem; /* 14px */
  --font-size-300: 1rem;     /* 16px */
  --font-size-400: 1.125rem; /* 18px */
  --font-size-500: 1.25rem;  /* 20px */
  --font-size-600: 1.5rem;   /* 24px */
  --font-size-700: 1.875rem; /* 30px */
  --font-size-800: 2.25rem;  /* 36px */
  --font-size-900: 3rem;     /* 48px */

  --line-tight: 1.2;
  --line-normal: 1.6;
  --line-loose: 1.8;

  --measure: 70ch; /* comfortable paragraph width */

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem;  /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem;    /* 16px */
  --space-5: 1.5rem;  /* 24px */
  --space-6: 2rem;    /* 32px */
  --space-7: 2.5rem;  /* 40px */
  --space-8: 3rem;    /* 48px */
  --space-9: 4rem;    /* 64px */
  --space-10: 5rem;   /* 80px */
  --space-11: 6rem;   /* 96px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --radius-round: 999px;

  /* Shadows (subtle, warm) */
  --shadow-sm: 0 1px 2px rgba(30, 30, 30, 0.12);
  --shadow-md: 0 6px 16px rgba(30, 30, 30, 0.14);
  --shadow-lg: 0 14px 32px rgba(30, 30, 30, 0.22);

  /* Transitions */
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  /* Layout */
  --container-max: 72rem; /* ~1152px */

  /* Decorative textures (CSS-only, no images) */
  --texture-parchment: radial-gradient(1200px 800px at 10% 10%, rgba(201, 162, 39, 0.07) 0%, transparent 50%),
                       radial-gradient(900px 600px at 85% 20%, rgba(140, 28, 19, 0.06) 0%, transparent 55%),
                       radial-gradient(800px 800px at 40% 90%, rgba(39, 70, 144, 0.05) 0%, transparent 60%);
  --texture-steel: linear-gradient(135deg, rgba(90, 103, 114, 0.14), rgba(90, 103, 114, 0.06));

  /* Focus ring */
  --focus-color: #8a6b02; /* deep antique gold for contrast */
  --focus-ring: 0 0 0 3px rgba(201, 162, 39, 0.45);
}


/* ========================================
   Reset / Normalize
   ======================================== */
* {
  box-sizing: border-box;
}
*::before,
*::after {
  box-sizing: inherit;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
  margin: 0;
}

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

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

/* Improve text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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


/* ========================================
   Base
   ======================================== */
body {
  min-height: 100dvh;
  font-family: var(--font-serif);
  font-size: var(--font-size-300);
  line-height: var(--line-normal);
  letter-spacing: 0.005em;
  color: var(--color-text);
  background-color: var(--color-background);
  background-image: var(--texture-parchment);
  background-size: cover;
  background-attachment: fixed;
}

main { display: block; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--line-tight);
  color: var(--color-text);
  letter-spacing: 0.015em; /* chiseled feel */
}

h1 { font-size: clamp(2rem, 1.2rem + 3vw, var(--font-size-900)); margin-top: var(--space-8); margin-bottom: var(--space-4); }
h2 { font-size: clamp(1.75rem, 1.1rem + 2vw, var(--font-size-800)); margin-top: var(--space-7); margin-bottom: var(--space-3); }
h3 { font-size: clamp(1.5rem, 1rem + 1.2vw, var(--font-size-700)); margin-top: var(--space-6); margin-bottom: var(--space-2); }
h4 { font-size: var(--font-size-600); margin-top: var(--space-5); margin-bottom: var(--space-2); }
h5 { font-size: var(--font-size-500); margin-top: var(--space-4); margin-bottom: var(--space-1); }
h6 { font-size: var(--font-size-400); margin-top: var(--space-3); margin-bottom: var(--space-1); }

p { max-width: var(--measure); }

p, ul, ol, pre, table, blockquote {
  margin-bottom: var(--space-4);
}

ul, ol {
  padding-left: var(--space-6);
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(41, 38, 33, 0.2), transparent);
  margin: var(--space-6) 0;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover { text-decoration: underline; }

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

/* Responsive media embeds */
iframe { max-width: 100%; border: 0; }


/* ========================================
   Utilities
   ======================================== */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section { padding-block: var(--space-9); }

.flow > * + * { margin-top: var(--flow-space, var(--space-5)); }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-7 { gap: var(--space-7); }
.gap-8 { gap: var(--space-8); }

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

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus styles (global) */
:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}


/* ========================================
   Components
   ======================================== */
/* Buttons */
.btn {
  --btn-bg: var(--gray-800);
  --btn-fg: #ffffff;
  --btn-border: transparent;

  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: calc(var(--space-2) + 1px) var(--space-4);
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  color: var(--btn-fg);
  background: var(--btn-bg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), var(--shadow-sm);
  transition: background-color var(--dur-base) var(--ease-standard),
              color var(--dur-base) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard);
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }

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

.btn-primary { --btn-bg: var(--color-primary); --btn-fg: var(--color-primary-contrast); }
.btn-secondary { --btn-bg: var(--color-steel); --btn-fg: #fff; }
.btn-success { --btn-bg: var(--color-success); --btn-fg: #fff; }
.btn-danger  { --btn-bg: var(--color-danger); --btn-fg: #fff; }
.btn-gold    { --btn-bg: var(--color-gold); --btn-fg: #1b1b1b; }

.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: var(--gray-400);
  background: transparent;
}
.btn-outline:hover { background: rgba(0,0,0,0.04); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--color-primary);
  --btn-border: transparent;
  background: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(39, 70, 144, 0.08); }

/* Inputs */
.input, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: #fff;
  color: var(--color-text);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard), background-color var(--dur-base) var(--ease-standard);
}

.input::placeholder, input::placeholder, textarea::placeholder { color: var(--gray-500); }

.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: var(--focus-ring), inset 0 1px 2px rgba(0,0,0,0.04);
}

input[disabled], select[disabled], textarea[disabled] { background-color: var(--gray-100); cursor: not-allowed; }

/* Cards */
.card {
  background-color: var(--color-surface);
  background-image: radial-gradient(600px 400px at 0% 0%, rgba(201,162,39,0.06), transparent 60%),
                    radial-gradient(500px 400px at 100% 20%, rgba(39,70,144,0.04), transparent 60%);
  border: 1px solid rgba(50, 50, 50, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.card-header { margin-bottom: var(--space-4); }
.card-title { font-family: var(--font-display); font-size: var(--font-size-600); line-height: var(--line-tight); }
.card-subtitle { color: var(--gray-600); font-size: var(--font-size-300); }
.card-content { color: var(--color-text); }

/* Emphasized callouts */
.callout {
  border-left: 4px solid var(--color-gold);
  background: linear-gradient(0deg, rgba(201,162,39,0.06), rgba(201,162,39,0.06)), var(--color-surface);
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

/* Badges (for small highlights) */
.badge {
  display: inline-block;
  padding: 0.25em 0.5em;
  font-size: 0.8125rem;
  border-radius: var(--radius-round);
  background: var(--color-steel);
  color: #fff;
}
.badge-gold { background: var(--color-gold); color: #1b1b1b; }
.badge-crimson { background: var(--color-accent); color: #fff; }

/* Navigation helpers */
.navbar {
  background: var(--texture-steel), var(--color-surface-2);
  border-bottom: 1px solid rgba(50,50,50,0.08);
  backdrop-filter: saturate(120%) blur(4px);
}


/* ========================================
   Accessibility
   ======================================== */
/* High-visibility skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus { left: 1rem; top: 1rem; width: auto; height: auto; padding: 0.5rem 0.75rem; background: var(--color-gold); color: #1b1b1b; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }

/* Focus-visible is handled globally; ensure controls show clear outline */
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Tables (basic normalization) */
table { border-collapse: collapse; width: 100%; }
th, td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--gray-200); }

/* Figures */
figure { margin: 0; }
figcaption { color: var(--gray-600); font-size: var(--font-size-200); margin-top: var(--space-2); }

/* Code blocks (optional base) */
code, kbd, samp { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.95em; }
pre { padding: var(--space-4); background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); overflow: auto; }

/* Forms layout helpers */
.form-row { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 48rem) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* Hero banner (immersive header) */
.hero {
  padding-block: var(--space-10);
  background: var(--texture-parchment), var(--color-background);
}
.hero .hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.25rem + 4vw, 3.5rem);
  line-height: var(--line-tight);
}
.hero .hero-subtitle { color: var(--gray-700); font-size: var(--font-size-400); max-width: 65ch; }

/* CTA alignment */
.cta-group { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* Media wrapper for videos */
.media { position: relative; }
.media.aspect-16x9 { aspect-ratio: 16 / 9; }
.media.aspect-4x3  { aspect-ratio: 4 / 3; }
.media > * { width: 100%; height: 100%; object-fit: cover; }

/* Footer basics */
.footer { color: var(--gray-700); font-size: var(--font-size-200); padding-block: var(--space-8); }

/* Small ornaments for headings (optional utility) */
.heading-rule {
  position: relative;
  padding-bottom: var(--space-2);
}
.heading-rule::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 4rem; height: 3px;
  background: linear-gradient(90deg, var(--color-gold), rgba(201,162,39,0.2));
  border-radius: 2px;
}

/* End */
