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

  /* Brand palette: soft white, graphite gray, deep navy, muted gold */
  --color-background: #FAFAF8; /* soft white */
  --color-surface: #FFFFFF;    /* cards, surfaces */
  --color-text: #2E3136;       /* graphite gray */
  --color-primary: #0F2748;    /* deep navy */
  --color-primary-600: #132E57;
  --color-primary-700: #0C1E38;
  --color-accent: #BFA85F;     /* muted gold */

  /* State colors */
  --color-success: #2E7D32;
  --color-warning: #BFA85F;
  --color-danger:  #B23A3A;

  /* Neutral grays */
  --gray-50:  #FAFAF9;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Typography */
  --font-sans: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-serif: 'Libre Baskerville', Georgia, 'Times New Roman', Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  --text-xs: 0.75rem;  /* 12px */
  --text-sm: 0.875rem; /* 14px */
  --text-base: 1rem;   /* 16px */
  --text-lg: 1.125rem; /* 18px */
  --text-xl: 1.25rem;  /* 20px */
  --text-2xl: clamp(1.35rem, 1.05rem + 1.2vw, 1.75rem);
  --text-3xl: clamp(1.6rem, 1.1rem + 2vw, 2.25rem);
  --text-4xl: clamp(2rem, 1.1rem + 3vw, 3rem);

  --line-tight: 1.2;
  --line-snug: 1.35;
  --line-normal: 1.5;
  --line-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-18: 72px;
  --space-20: 80px;
  --space-24: 96px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --duration-fast: 120ms;
  --duration-normal: 180ms;
  --duration-slow: 280ms;
  --easing-standard: cubic-bezier(0.2, 0.8, 0.2, 1);

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

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

html { 
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  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; }

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

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ========================================================================== 
   Base
   ========================================================================== */
body {
  min-height: 100dvh;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-relaxed);
  letter-spacing: 0.01em;
}

::selection { background-color: var(--color-primary); color: #FFFFFF; }

/* Headings: elegant serif, tightened leading */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--color-text);
  font-weight: 600;
  line-height: var(--line-tight);
  letter-spacing: 0.005em;
}

h1 { font-size: var(--text-4xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--text-3xl); margin-bottom: var(--space-5); }
h3 { font-size: var(--text-2xl); margin-bottom: var(--space-4); }
h4 { font-size: var(--text-xl);  margin-bottom: var(--space-4); }
h5 { font-size: var(--text-lg);  margin-bottom: var(--space-3); }
h6 { font-size: var(--text-base); margin-bottom: var(--space-2); }

p { 
  max-width: 70ch;
  margin-bottom: var(--space-6);
}

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

small { font-size: var(--text-sm); }

/* Links: understated, reveal underline on hover */
a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--duration-normal) var(--easing-standard), text-decoration-color var(--duration-normal) var(--easing-standard);
}

a:hover { text-decoration: underline; }

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

hr { border: 0; border-top: 1px solid var(--gray-200); margin: var(--space-8) 0; }

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

/* Layout helpers */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; gap: var(--space-6); }

.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-xs { gap: var(--space-2); }
.gap-sm { gap: var(--space-3); }
.gap-md { gap: var(--space-4); }
.gap-lg { gap: var(--space-6); }
.gap-xl { gap: var(--space-8); }

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

/* A responsive grid utility ideal for product listings */
.grid-auto { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Screen reader only */
.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;
}

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

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 40px;
  padding-inline: var(--space-5);
  padding-block: calc(var(--space-2) + 2px);
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-normal) var(--easing-standard), color var(--duration-normal) var(--easing-standard), border-color var(--duration-normal) var(--easing-standard), box-shadow var(--duration-normal) var(--easing-standard);
}

.btn:hover { filter: brightness(1.02); }
.btn:active { filter: brightness(0.98); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn--primary { --btn-bg: var(--color-primary); --btn-fg: #FFFFFF; --btn-border: var(--color-primary); }
.btn--secondary { --btn-bg: var(--color-surface); --btn-fg: var(--color-primary); --btn-border: var(--gray-300); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--color-primary); --btn-border: transparent; }
.btn--ghost:hover { background-color: var(--gray-100); }

/* Inputs */
.input, input[type='text'], input[type='email'], input[type='search'], input[type='tel'], input[type='password'], input[type='number'], select, textarea {
  width: 100%;
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: calc(var(--space-2) + 2px) var(--space-4);
  line-height: var(--line-normal);
  transition: border-color var(--duration-normal) var(--easing-standard), box-shadow var(--duration-normal) var(--easing-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-primary);
  box-shadow: 0 0 0 3px rgba(15, 39, 72, 0.12);
}

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

/* Checkbox & radio minimal tweak */
input[type='checkbox'], input[type='radio'] { accent-color: var(--color-primary); }

/* Card */
.card { 
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.card--hoverable { transition: box-shadow var(--duration-normal) var(--easing-standard), transform var(--duration-normal) var(--easing-standard); }
.card--hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Focus visibly for all interactive elements */
:where(a, button, [role='button'], input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}
