/* ================================================================
   SUBCENTRIC — Design System
   Aesthetic: Studio Craft — warm, refined, editorial
   ================================================================ */

/* === Custom Properties === */
:root {
  /* Colors */
  --color-bg: #F7F5F2;
  --color-surface: #FFFFFF;
  --color-text: #1C1917;
  --color-muted: #78716C;
  --color-faint: #A8A29E;
  --color-accent: #1A5B6B;
  --color-accent-hover: #134852;
  --color-accent-light: rgba(26, 91, 107, 0.08);
  --color-border: #E7E5E0;
  --color-border-strong: #D6D3CE;
  --color-success-bg: #ECFDF5;
  --color-success-text: #065F46;
  --color-success-border: #A7F3D0;
  --color-error-bg: #FEF2F2;
  --color-error-text: #991B1B;
  --color-error-border: #FECACA;

  /* Typography — ready for Adobe font overrides */
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-4xl: 8rem;

  /* Layout */
  --max-width: 52rem;
  --max-width-narrow: 38rem;
  --max-width-wide: 68rem;
  --header-height: 4rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 100px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.04), 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.06), 0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 12px 40px rgba(28, 25, 23, 0.08), 0 4px 12px rgba(28, 25, 23, 0.04);
  --shadow-xl: 0 20px 60px rgba(28, 25, 23, 0.1), 0 8px 20px rgba(28, 25, 23, 0.05);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

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

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

/* === Body & Grain Overlay === */
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* === Layout === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

main {
  flex: 1;
}

/* === Typography === */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  max-width: 65ch;
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--duration-fast) ease;
}

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

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

::selection {
  background: var(--color-accent);
  color: white;
}

/* === Skip Link === */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-decoration: none;
  z-index: 10000;
  transition: top var(--duration-fast) ease;
}

.skip-link:focus {
  top: var(--space-md);
  color: var(--color-bg);
}

/* ================================================================
   HEADER
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 242, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity var(--duration-fast) ease;
}

.site-logo:hover {
  opacity: 0.7;
  color: var(--color-text);
}

.site-nav ul {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
}

.site-nav a {
  position: relative;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color var(--duration-fast) ease;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-accent);
  transition: width var(--duration-normal) var(--ease-out);
}

.site-nav a:hover {
  color: var(--color-text);
}

.site-nav a:hover::after {
  width: 100%;
}

.site-nav a[aria-current="page"] {
  color: var(--color-text);
}

.site-nav a[aria-current="page"]::after {
  width: 100%;
  background: var(--color-text);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--color-text);
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(247, 245, 242, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--space-2xl) var(--space-lg);
    transform: translateX(100%);
    transition: transform var(--duration-slow) var(--ease-out);
    z-index: 99;
  }

  .site-nav.is-open {
    transform: translateX(0);
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .site-nav a {
    display: block;
    font-size: 1.5rem;
    font-family: var(--font-display);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border);
    letter-spacing: -0.01em;
  }

  .site-nav a::after {
    display: none;
  }
}

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3xl) 0 var(--space-2xl);
  margin-top: var(--space-4xl);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-2xl);
}

.footer-brand {
  max-width: 280px;
}

.footer-brand .site-logo {
  display: inline-block;
  margin-bottom: var(--space-md);
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.6;
}

.footer-col h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-faint);
  margin-bottom: var(--space-md);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-col a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--duration-fast) ease;
}

.footer-col a:hover {
  color: var(--color-text);
}

.footer-bottom {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright {
  font-size: 0.8rem;
  color: var(--color-faint);
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

/* ================================================================
   PAGE CONTENT — Standard text pages
   ================================================================ */
.page-content {
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.page-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out) forwards;
}

.page-content h1 {
  margin-bottom: var(--space-xl);
}

.page-content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-top: var(--space-md);
}

.page-content h3 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.page-content p,
.page-content ul,
.page-content ol {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.page-content ul,
.page-content ol {
  padding-left: var(--space-lg);
}

.page-content li {
  margin-bottom: var(--space-sm);
}

.page-content li::marker {
  color: var(--color-faint);
}

/* ================================================================
   HERO — Home page
   ================================================================ */
.hero {
  padding: var(--space-4xl) 0 var(--space-3xl);
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--color-accent-light) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: var(--space-md);
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.1s forwards;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--color-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.25s forwards;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out) forwards;
}

/* ================================================================
   PRODUCT GRID — Home page cards
   ================================================================ */
.products-overview {
  padding: var(--space-xl) 0 var(--space-3xl);
}

.products-overview > .container > h2 {
  text-align: center;
  margin-bottom: var(--space-2xl);
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-faint);
}

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

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) ease;
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-strong);
}

.product-card:hover::before {
  transform: scaleX(1);
}

.product-card .card-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.product-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

.product-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.product-card h3 a:hover {
  color: var(--color-accent);
}

.product-card p {
  color: var(--color-muted);
  margin-bottom: var(--space-lg);
  font-size: 0.95rem;
  line-height: 1.6;
}

.product-card .btn {
  font-size: 0.825rem;
}

/* ================================================================
   PRODUCT PAGE — Individual product hero & content
   ================================================================ */
.product-hero {
  text-align: center;
  padding: var(--space-3xl) 0 var(--space-lg);
}

.product-icon {
  width: 96px;
  height: 96px;
  margin-bottom: var(--space-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.product-hero h1 {
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.1s forwards;
}

.tagline {
  font-size: 1.15rem;
  color: var(--color-muted);
  margin-top: var(--space-sm);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.25s forwards;
}

.product-content {
  padding: var(--space-xl) 0 var(--space-2xl);
}

.product-content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.product-content p,
.product-content ul {
  margin-bottom: var(--space-md);
}

.product-content ul {
  padding-left: var(--space-lg);
}

.product-content li {
  margin-bottom: var(--space-sm);
}

.product-content li::marker {
  color: var(--color-faint);
}

.product-cta {
  text-align: center;
  padding: var(--space-2xl) 0;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  letter-spacing: 0.01em;
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-primary {
  background: var(--color-text);
  color: var(--color-bg);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border-strong);
}

.btn-secondary:hover {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
  transform: translateY(-1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: translateY(0);
}

/* ================================================================
   CONTACT FORM
   ================================================================ */
.contact-form {
  margin-top: var(--space-xl);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.825rem;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.925rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
  -webkit-appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-faint);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2378716C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group textarea {
  min-height: 10rem;
  resize: vertical;
  line-height: 1.6;
}

.form-status {
  margin-bottom: var(--space-md);
  padding: 0;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) ease;
}

.form-status:not(:empty) {
  padding: 0.875rem 1.25rem;
}

.form-status--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}

.form-status--error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ================================================================
   CHECKOUT — Buy page
   ================================================================ */
.checkout-page {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.checkout-page p {
  max-width: 480px;
  margin: 0 auto var(--space-xl);
  color: var(--color-muted);
  font-size: 1.05rem;
}

#checkout-container {
  margin-top: var(--space-xl);
}

/* ================================================================
   THANKS — Post-purchase
   ================================================================ */
.thanks-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-size: 1.75rem;
  margin-bottom: var(--space-lg);
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-in {
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out) forwards;
}

.animate-in-d1 { animation-delay: 0.1s; }
.animate-in-d2 { animation-delay: 0.2s; }
.animate-in-d3 { animation-delay: 0.3s; }
.animate-in-d4 { animation-delay: 0.4s; }

/* ================================================================
   UTILITIES
   ================================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--color-muted); }
.text-faint { color: var(--color-faint); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

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

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  :root {
    --space-3xl: 4rem;
    --space-4xl: 5rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  body::after,
  .site-header,
  .site-footer,
  .nav-toggle,
  .btn {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}
