/* ===== FONT FACE ===== */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ===== CSS VARIABLES ===== */
:root {
  --line-thickness: 2px;  /* Standard thickness for all borders, underlines, dividers */
  --margin-outer: 18px;   /* Desktop outer margins */
  --margin-outer-mobile: 12px; /* Mobile outer margins */
  --gutter: 14px;         /* Gutter between grid columns */
  --button-radius: 14px;  /* Button border radius (outline style) */
}

/* ===== RESET ===== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background-color: #fff;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Inter', sans-serif;
  font-size: 1.25rem; /* larger on desktop */
  color: #000; /* body text black */
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%; /* Prevent auto text sizing on orientation change */
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.3;
}

/* ===== TYPOGRAPHY ===== */
/* Ensure all text elements have consistent line-height */
p, div, span, label, a, li, td, th {
  line-height: 1.3;
}

/* Removed: Now using border-bottom system for all underlines (pixel-perfect consistency) */

/* ===== BUTTONS ===== */
/* Outline style buttons - transparent bg with border */
button, .btn {
  background-color: transparent;
  color: #000;
  border: var(--line-thickness) solid #000;
  border-radius: var(--button-radius);
  padding: 0.8rem 2rem;
  margin-bottom: 2rem; /* Double space between major sections */
  cursor: pointer;
  font-family: inherit;
  font-weight: normal;
  -webkit-tap-highlight-color: transparent; /* Remove mobile tap overlay */
  touch-action: manipulation; /* Remove 300ms tap delay (2025 standard) */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button:disabled, .btn:disabled {
  background-color: transparent;
  border-color: #bdbdbd;
  color: #bdbdbd;
  cursor: not-allowed;
}

button:focus, .btn:focus {
  outline: none; /* Remove focus outline */
}

button:active, .btn:active {
  background-color: #999;
  border-color: #999;
  color: #fff;
}

@media (hover: hover) {
  button:hover, .btn:hover {
    background-color: #999;
    border-color: #999;
    color: #fff;
  }

  button:disabled:hover, .btn:disabled:hover {
    background-color: transparent;
    border-color: #bdbdbd;
    color: #bdbdbd;
  }
}

/* ===== HEADINGS ===== */
h1, h2, h3, h4, h5, h6 {
  color: #000;
  font-weight: normal;
  font-size: inherit;
  line-height: 1.3;
}

.container h1 {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: normal;
  line-height: 1.3;
  display: inline-block;
  width: fit-content;
  position: relative;
}

.container h1::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

.container h2 {
  color: #000;
  font-weight: normal;
  font-size: inherit;
  margin-top: 3em;
  margin-bottom: 0.375em;  /* 50% more space under underlined headers */
  line-height: 1.3;
  break-inside: avoid;
  display: inline-block;
  width: fit-content;
  position: relative;
}

.container h2::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

.container h2.force-column,
.container section.force-column {
  break-before: column;
}

.container section.end-column {
  break-after: column;
}

/* Remove top margin from first child in sections (aligns columns) */
.container section > h2:first-child,
.container section > h3:first-child,
.container section > p:first-child {
  margin-top: 0;
}

.container p {
  margin-top: 0;
  margin-bottom: 1em;
  line-height: 1.3;
}

.container .indent {
  padding-left: 2em;
  text-indent: -2em;
  margin-bottom: 1em;
}

.container a {
  color: #000;
  text-decoration: none;
  position: relative;
  display: inline-block;
  touch-action: manipulation; /* Remove 300ms tap delay (2025 standard) */
  transition: color 0.2s ease;
}

.container a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: currentColor;
}

@media (hover: hover) {
  .container a:hover {
    color: #999;
  }
}

.two-columns {
  column-count: 2;
  column-gap: 2.5rem;
}

/* ===== GRID SYSTEM ===== */
/* Grid container - applies outer margins */
.grid-container {
  padding-left: var(--margin-outer);
  padding-right: var(--margin-outer);
  box-sizing: border-box;
}

/* 2-Column Grid - true 50/50 split */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
}

/* 3-Column Grid */
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}

/* 4-Column Grid */
.grid-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}

/* Section spacing (desktop and mobile) */
.two-columns section {
  margin-bottom: 3.75rem;  /* 50% more than original 2.5rem */
}

.two-columns section:last-child {
  margin-bottom: 0;
}

.product-title {
  font-weight: normal;
  font-size: inherit;
  margin-top: 0;
  margin-bottom: 0.25em;
  line-height: 1.3;
  display: inline-block;
  width: fit-content;
  position: relative;
}

.product-title::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

/* ===== MEL LOGO TOP LEFT ===== */
#overlayText2 {
  position: absolute;
  top: var(--margin-outer);
  left: var(--margin-outer);
  color: #000;
  font-family: serif;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  line-height: 1; /* Removes extra vertical space from line-height */
  z-index: 10;
}

#overlayText2 a {
  color: #000; /* default black for all pages */
  text-decoration: none;
  font-weight: bold;
}

/* White MEL on homepage only */
body.home #overlayText2 a {
  color: #ffffff !important;
}

/* Hover for MEL link (all pages) */
@media (hover: hover) {
  #overlayText2 a:hover {
    color: #999;
  }
}

/* ===== FOOTER ===== */
footer {
  background: #fff;
  padding: var(--margin-outer);
  text-align: left;
  flex-shrink: 0;
  margin: 0;
  box-sizing: border-box;
  color: #000; /* footer text black */
  line-height: 1; /* Removes extra vertical space from line-height */
}

footer .footer-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
}

footer .footer-links {
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

footer .footer-links a {
  color: #000;
  text-decoration: none;
  margin-left: 15px;
  white-space: nowrap;
}

footer .footer-links a:first-child {
  margin-left: 0;
}

/* Footer hover gray */
@media (hover: hover) {
  footer .footer-links a:hover {
    color: #999;
  }
}

footer .footer-links + div {
  font-family: 'Inter', sans-serif;
  color: #000;
  margin-top: 0;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  body {
    font-size: 1.125rem; /* slightly smaller on mobile */
  }

  #overlayText2 {
    position: absolute; /* scrolls with content */
    top: var(--margin-outer-mobile);
    left: var(--margin-outer-mobile);
    font-size: 1.125rem;
  }

  footer .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }

  footer .footer-links {
    width: auto;
    margin-bottom: 1rem;
  }

  footer .footer-links a {
    margin-left: 0;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
  }

  footer .footer-links + div {
    margin-top: 0;
  }

  .two-columns {
    column-count: 1;
    column-gap: 0;
  }

  /* Disable column breaks on mobile - single column layout */
  .container h2.force-column,
  .container section.force-column,
  .container section.end-column {
    break-before: auto;
    break-after: auto;
  }

  /* Grid system mobile - tighter margins and stacked columns */
  .grid-container {
    padding-left: var(--margin-outer-mobile);
    padding-right: var(--margin-outer-mobile);
  }

  .grid-2col,
  .grid-3col,
  .grid-4col {
    grid-template-columns: 1fr;
  }
}

/* ===== UTILITY CLASSES ===== */
/* Visibility utilities for systematic show/hide control */
.show {
  display: block;
}

.hide {
  display: none;
}

/* Tabular figures for numeric UI elements */
/* Makes all digits equal width for alignment and balanced parentheses */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Error link styling (used in checkout error messages) */
.error-link {
  color: #000;
  text-decoration: none;
  border-bottom: var(--line-thickness) solid #000;
  display: inline;
  padding-bottom: 0;
}

@media (hover: hover) {
  .error-link:hover {
    color: #999;
    border-bottom-color: #999;
  }
}

/* ===== UNDERLINE SYSTEM ===== */
/* Centralized underline patterns - see design-standards.md for documentation */

/* Base underlined class - apply to any element that needs text-width underline */
.underlined {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.underlined::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: currentColor;
}

/* No underline utility - removes ::after underline from inherited styles */
.no-underline::after {
  display: none;
}

/* Page-specific underlined elements (centralized here instead of inline styles) */

/* Thank-you page */
.order-details h2,
.delivery-info h3 {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.order-details h2::after,
.delivery-info h3::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

/* Cart page */
.remove-btn {
  position: relative;
  display: inline-block;
  width: fit-content;
}

.remove-btn::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: currentColor;
}

.sidebar-title {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.sidebar-title::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

/* Checkout page */
.container .form-section-heading,
.container h2.form-section-heading,
.container h3.form-section-heading {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.container .form-section-heading::after,
.container h2.form-section-heading::after,
.container h3.form-section-heading::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

.product-summary h2 {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.product-summary h2::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

.section-heading {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: #000;
}

/* Product page modals */
.modal-link a {
  display: inline-block;
  width: fit-content;
  position: relative;
}

.modal-link a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.05em;
  height: var(--line-thickness);
  background: currentColor;
}

/* Cart empty state - button styled as link without underline */
.cart-empty a::after {
  display: none;
}

/* Thank-you continue shopping - button without underline */
.container .continue-shopping::after {
  display: none;
}

/* FAQ page - headings without underlines (accordion style) */
.faq-section h2::after {
  display: none;
}

/* Privacy policy page - headings without underlines */
.policy-section h2::after {
  display: none;
}
