/* ============================================================
   Finlay3D — design system
   A print-catalog aesthetic: paper background, inked type,
   sticker-tag prices, hairline rules instead of card shadows.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500&display=swap');

:root {
  --paper: #f2ede2;
  --paper2: #ece5d5;
  --ink: #171512;
  --ink-soft: #56514a;
  --accent: #2b4dff;
  --accent-ink: #ffffff;
  --tag: #ffcf3f;
  --card: #fffdf8;
  --line: rgba(23,21,18,0.14);
  --line-strong: rgba(23,21,18,0.9);
  --radius-sm: 4px;
  --radius: 8px;
}

/* Dark mode: ink and paper swap roles, accent brightens for contrast
   on a dark surface, everything else keys off the same variable names
   so no component styles need duplicating. */
html[data-theme="dark"] {
  --paper: #17151a;
  --paper2: #1e1c22;
  --ink: #f0eee6;
  --ink-soft: #9b978d;
  --accent: #5c78ff;
  --accent-ink: #101014;
  --tag: #ffcf3f;
  --card: #201e24;
  --line: rgba(240,238,230,0.14);
  --line-strong: rgba(240,238,230,0.85);
}

html[data-theme="dark"] .hero-swatch img,
html[data-theme="dark"] .product-img-tag { filter: none; }

body, .masthead, .cart-drawer, .cart-tab, .tile, .toast {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(rgba(23,21,18,0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

.f-display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.f-mono {
  font-family: 'IBM Plex Mono', monospace;
}

a { color: inherit; }

/* ── MASTHEAD ── */
.masthead {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.mast-logo {
  width: 42px; height: 42px;
  object-fit: contain;
}

.mast-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.mast-brand:hover { opacity: 0.7; transform: translateY(-1px); }
.mast-logo { transition: transform 0.4s cubic-bezier(.34,1.56,.64,1); }
.mast-brand:hover .mast-logo { transform: rotate(-8deg) scale(1.08); }

.mast-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.mast-name .dot { color: var(--accent); }

.mast-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

.mast-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mast-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.mast-link:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.mast-link:active { transform: translateY(0) scale(0.96); }
.mast-link svg { transition: transform 0.2s cubic-bezier(.34,1.56,.64,1); }
.mast-link:hover svg { transform: translateX(-4px); }

/* ── SHARED LAYOUT ── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }

footer.site-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  text-align: left;
  padding: 28px 32px 36px;
  border-top: 2px solid var(--ink);
  margin-top: 64px;
}
footer.site-foot p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.foot-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, transform 0.15s cubic-bezier(.34,1.56,.64,1);
  display: inline-block;
}
.foot-link:hover { color: var(--accent); transform: translateY(-1px); }
.foot-sep { margin-left: auto; }
@media (max-width: 480px) {
  .foot-sep { margin-left: 0; }
}

/* ── SETTINGS PANEL (dark/light + T&Cs) ── */
.settings-scrim {
  position: fixed; inset: 0;
  background: rgba(23,21,18,0.45);
  z-index: 1150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.settings-scrim.open { opacity: 1; pointer-events: auto; }

.settings-panel {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.85) translateY(20px);
  width: min(560px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  z-index: 1151;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(.34,1.56,.64,1);
}
.settings-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1) translateY(0); }

.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 2px solid var(--ink);
}
.settings-head h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; }
.settings-close {
  background: none; border: 1.5px solid var(--ink); color: var(--ink);
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.settings-close:hover { background: var(--ink); color: var(--paper); transform: rotate(90deg); }

.settings-body { overflow-y: auto; padding: 20px 22px 24px; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.settings-row-label { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; }
.settings-row-sub { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

.theme-switch {
  position: relative;
  width: 52px; height: 28px;
  background: var(--paper2);
  border: 1.5px solid var(--ink);
  border-radius: 100px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.theme-switch:active .theme-switch-knob { width: 24px; }
.theme-switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: var(--ink);
  border-radius: 50%;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), width 0.15s ease, rotate 0.35s ease;
}
html[data-theme="dark"] .theme-switch-knob { transform: translateX(24px) rotate(180deg); }

.tcs-block { padding-top: 16px; }
.tcs-block h4 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px;
  margin: 16px 0 6px;
}
.tcs-block h4:first-child { margin-top: 0; }
.tcs-block p, .tcs-block li {
  font-size: 13px; color: var(--ink-soft); line-height: 1.6;
}
.tcs-block ul { padding-left: 18px; margin-top: 4px; }
.tcs-note {
  margin-top: 16px; padding: 12px 14px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) rotate(var(--tilt, 0deg)); }
  to   { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)); }
}

@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.6) rotate(var(--tilt, 0deg)); }
  60%  { opacity: 1; transform: scale(1.06) rotate(var(--tilt, 0deg)); }
  100% { opacity: 1; transform: scale(1) rotate(var(--tilt, 0deg)); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

button, .btn-solid, .btn-outline, .mast-link, .foot-link, .filter-btn, .qty-control button {
  -webkit-tap-highlight-color: transparent;
}
button:active, .btn-solid:active, .btn-outline:active { transition-duration: 0.1s; }

@media (max-width: 768px) {
  .masthead { padding: 13px 18px; }
  .wrap { padding: 0 18px; }
}

@media (max-width: 400px) {
  .mast-sub { display: none; }
  .mast-logo { width: 34px; height: 34px; }
  .mast-name { font-size: 19px; }
  .masthead { gap: 10px; }
}