/* ==========================================================================
   Rez Rugs - site styles
   A thin layer over Bootstrap 5. Bootstrap handles the grid, the collapse
   nav and the modal; everything visual below is ours.

   Design rule for this site: the chrome is deliberately quiet and neutral.
   Rugs are the colour. Anything that competes with the photography loses.
   ========================================================================== */

/* --- Self-hosted faces. No Google Fonts CDN, no extra DNS handshake. ----- */
@font-face {
  font-family: "Work Sans";
  src: url("../fonts/work-sans-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-variable.woff2") format("woff2-variations");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens. Light values live on bare :root so a viewer with no explicit
   choice still gets a complete palette; the dark block only redefines.
   -------------------------------------------------------------------------- */
:root {
  --clay: #B4552D;
  --clay-soft: #C9764F;
  --clay-wash: rgba(180, 85, 45, 0.10);

  --ink: #1F1A15;
  --ink-soft: #5C5349;
  --ink-faint: #8B8177;

  --paper: #FBF8F4;
  --paper-alt: #F3EDE5;
  --paper-line: #E3DACE;
  --paper-card: #FFFFFF;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 34px rgba(31, 26, 21, 0.10);
  --shadow-sm: 0 4px 14px rgba(31, 26, 21, 0.07);

  --container: 1180px;
  --font-head: "Work Sans", "Segoe UI", Arial, sans-serif;
  --font-body: "Work Sans", "Segoe UI", Arial, sans-serif;
  --font-label: "Oswald", "Segoe UI", Arial, sans-serif;

  color-scheme: light dark;
}

[data-bs-theme="dark"] {
  --clay: #E08A5F;
  --clay-soft: #C9764F;
  --clay-wash: rgba(224, 138, 95, 0.14);

  --ink: #F4EFE8;
  --ink-soft: #B3A99D;
  --ink-faint: #857B71;

  --paper: #16130F;
  --paper-alt: #1E1A15;
  --paper-line: #2E2820;
  --paper-card: #1E1A15;

  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 650;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: clamp(2.25rem, 5.2vw, 3.75rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.25rem; }

a { color: var(--clay); text-underline-offset: 3px; }
a:hover { color: var(--clay-soft); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--clay);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* Visible focus everywhere. Removing this is never the fix for anything. */
:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 2px;
  border-radius: 3px;
}

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-alt { background: var(--paper-alt); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 14px;
}

.lede {
  color: var(--ink-soft);
  font-size: 1.125rem;
  max-width: 62ch;
}

.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 26px;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover, .btn-clay:focus { background: var(--clay-soft); color: #fff; }

.btn-outline-ink {
  border-color: var(--paper-line);
  color: var(--ink);
  background: transparent;
}
.btn-outline-ink:hover, .btn-outline-ink:focus {
  border-color: var(--clay);
  color: var(--clay);
  background: var(--clay-wash);
}

.btn-lg { padding: 15px 34px; font-size: 1.0625rem; }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--paper-line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand img { height: 34px; width: auto; display: block; }
.brand .mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--clay);
  color: #fff;
  font-size: 1.05rem;
  flex: none;
}

.site-header .nav-link {
  color: var(--ink-soft);
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 999px;
}
.site-header .nav-link:hover { color: var(--ink); background: var(--clay-wash); }
.site-header .nav-link.active { color: var(--clay); }

.navbar-toggler {
  border: 1.5px solid var(--paper-line);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.navbar-toggler:focus { box-shadow: none; }

.theme-toggle {
  background: transparent;
  border: 1.5px solid var(--paper-line);
  color: var(--ink-soft);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex: none;
}
.theme-toggle:hover { color: var(--clay); border-color: var(--clay); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(78vh, 680px);
  display: flex;
  align-items: center;
  background: var(--paper-alt) center / cover no-repeat;
  isolation: isolate;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(20, 16, 12, 0.86) 0%, rgba(20, 16, 12, 0.62) 46%, rgba(20, 16, 12, 0.22) 100%);
}
.hero-inner { padding: clamp(56px, 9vw, 120px) 0; max-width: 720px; }
.hero h1 { color: #FFFFFF; }
.hero .eyebrow { color: var(--clay-soft); }
.hero .lede { color: rgba(255, 255, 255, 0.86); margin: 20px 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* Interior pages get a compact band instead of the full hero. */
.page-banner {
  background: var(--paper-alt);
  border-bottom: 1px solid var(--paper-line);
  padding: clamp(44px, 6vw, 76px) 0;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card-soft {
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  height: 100%;
  overflow: hidden;
}
.card-soft .card-body { padding: 26px; }
.card-soft > img { width: 100%; height: 220px; object-fit: cover; display: block; }

.pillar-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--clay-wash);
  color: var(--clay);
  font-size: 1.5rem;
  margin-bottom: 18px;
}

.step-num {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  color: var(--clay);
  display: block;
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Instagram grid
   Tiles are our own markup around a locally hosted image, so the caption
   text is real page content that search engines can read. The official
   Instagram embed is loaded on demand behind .ig-tile (see js/main.js),
   which keeps ~500KB of third-party JS off the initial page load.
   -------------------------------------------------------------------------- */
.ig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.ig-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-alt);
  cursor: pointer;
  text-align: left;
}
.ig-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.ig-tile:hover img, .ig-tile:focus-visible img { transform: scale(1.05); }

.ig-tile figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 34px 14px 12px;
  background: linear-gradient(to top, rgba(15, 12, 9, 0.9), rgba(15, 12, 9, 0));
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.ig-tile:hover figcaption,
.ig-tile:focus-visible figcaption { opacity: 1; transform: none; }

/* Always-visible glyph so the tile reads as Instagram even before hover. */
.ig-tile .ig-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(15, 12, 9, 0.55);
  color: #fff;
  font-size: 1rem;
  backdrop-filter: blur(4px);
}

.ig-tile .ig-video {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2.5rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Caption shown below the tile on /work, where the point is readable
   content rather than a tight grid. */
.ig-caption {
  color: var(--ink-soft);
  font-size: 0.9375rem;
  margin-top: 12px;
}

/* Fallback shown if data/feed.json is empty or fails to load. */
.ig-empty {
  border: 1px dashed var(--paper-line);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-soft);
  grid-column: 1 / -1;
}

.modal-content {
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
}
.modal-header { border-bottom-color: var(--paper-line); }
#igEmbedHost { min-height: 420px; display: grid; place-items: center; }
#igEmbedHost iframe { max-width: 100% !important; }

/* --------------------------------------------------------------------------
   Quote form + uploads
   -------------------------------------------------------------------------- */
.form-panel {
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 40px);
}

.form-label { font-weight: 600; font-size: 0.9375rem; margin-bottom: 6px; }

.form-control, .form-select {
  background: var(--paper);
  border: 1.5px solid var(--paper-line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.form-control:focus, .form-select:focus {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--clay);
  box-shadow: 0 0 0 4px var(--clay-wash);
}
.form-control::placeholder { color: var(--ink-faint); }

.dropzone {
  border: 2px dashed var(--paper-line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--clay);
  background: var(--clay-wash);
}
.dropzone .ti { font-size: 2.25rem; color: var(--clay); }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--paper-line);
  background: var(--paper-alt);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .meta {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(15, 12, 9, 0.72);
  color: #fff;
  font-size: 0.6875rem;
  padding: 3px 6px;
  text-align: center;
}
.thumb .no-preview {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--ink-faint);
  font-size: 1.75rem;
}
.thumb button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 12, 9, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0;
}
.thumb button:hover { background: #B4291B; }

.honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.alert-success-soft {
  background: rgba(46, 125, 74, 0.12);
  border: 1px solid rgba(46, 125, 74, 0.35);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.alert-error-soft {
  background: rgba(180, 41, 27, 0.12);
  border: 1px solid rgba(180, 41, 27, 0.35);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

/* --------------------------------------------------------------------------
   CTA band + footer
   -------------------------------------------------------------------------- */
.cta-band {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: clamp(30px, 5vw, 52px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.cta-band h2 { color: var(--paper); margin: 0 0 6px; }
.cta-band p { color: color-mix(in srgb, var(--paper) 72%, transparent); margin: 0; max-width: 52ch; }
[data-bs-theme="dark"] .cta-band { border: 1px solid var(--paper-line); }

.site-footer {
  background: var(--paper-alt);
  border-top: 1px solid var(--paper-line);
  padding: clamp(44px, 6vw, 72px) 0 28px;
}

.footer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  color: var(--ink);
  text-decoration: none;
  height: 100%;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.footer-card:hover { border-color: var(--clay); color: var(--ink); transform: translateY(-2px); }
.footer-card .ti { font-size: 1.5rem; color: var(--clay); flex: none; }
.footer-card .label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.footer-card .value { display: block; font-weight: 600; word-break: break-word; }

.footer-bottom {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--paper-line);
  color: var(--ink-faint);
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
}
.footer-bottom a { color: var(--ink-soft); text-decoration: underline; }
.footer-bottom a:hover { color: var(--clay); }

.credit-badge {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.8125rem;
  color: var(--ink-faint);
  text-decoration: none;
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  padding: 5px 14px;
}
.credit-badge:hover { color: var(--clay); border-color: var(--clay); }

/* Long content tables/blocks must scroll themselves, never the page body. */
.table-scroll { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
