/* ============================================================
   ThirdLayer3D - storefront styles
   To re-theme the site, edit the variables below.
   ============================================================ */

:root {
  /* ---- Brand colors: edit these to restyle the whole site ---- */
  --ink: #0e1116;          /* near-black: header, footer, headings */
  --ink-2: #171b22;        /* raised dark surfaces */
  --ink-3: #222834;        /* borders on dark */
  --paper: #f5f6f4;        /* soft off-white page background */
  --paper-2: #eceee9;      /* alternate band background */
  --card: #ffffff;         /* cards and panels */
  --line: #e6e7e2;         /* hairline borders */
  --text: #242832;         /* body text on light */
  --muted: #697083;        /* secondary text */
  --green: #16b866;        /* primary action / "Buy Now" */
  --green-deep: #0e9a54;   /* hover state */
  --green-ink: #0a1f14;    /* text on green buttons */
  --green-soft: #e4f7ec;   /* tinted backgrounds */
  --green-line: #b9e9cd;   /* tinted borders */
  --amber: #f59e0b;        /* small highlights, badges */
  --danger: #dc2626;

  /* ---- Type ---- */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Karla", "Segoe UI", system-ui, sans-serif;

  /* ---- Shape ---- */
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(16, 19, 25, .05), 0 6px 20px rgba(16, 19, 25, .06);
  --shadow-lift: 0 2px 6px rgba(16, 19, 25, .08), 0 22px 48px rgba(16, 19, 25, .16);
  --ring: 0 0 0 3px rgba(22, 184, 102, .2);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--green-deep); }
img { max-width: 100%; display: block; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.nav {
  display: flex; align-items: center; gap: 24px;
  height: 66px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  color: #fff; text-decoration: none; letter-spacing: -.02em;
  margin-right: auto;
}
.brand svg { display: block; }
.brand em { font-style: normal; color: var(--green); }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 14px; border-radius: 999px;
  color: #cfd2d9; text-decoration: none; font-weight: 500; font-size: .98rem;
  transition: color .15s, background-color .15s;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-links a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); font-weight: 700; }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--green); border-radius: 2px;
}
.nav-links li { position: relative; }

.cart-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--green); color: var(--green-ink); text-decoration: none;
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 16px; font-weight: 700; font-size: .95rem;
  transition: box-shadow .15s, transform .15s, background-color .15s;
}
.cart-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22,184,102,.35); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .8rem;
  border-radius: 999px;
}
.cart-count:empty, .cart-count[data-zero] { display: none; }

.nav-toggle {
  display: none; background: none; border: 0; color: #fff;
  padding: 8px; cursor: pointer;
}

@media (max-width: 760px) {
  .nav { gap: 12px; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 12px 16px 16px;
    background: var(--ink); border-bottom: 1px solid rgba(255, 255, 255, .1);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: var(--radius-sm); }
}

/* ---------- hero (dark band w/ print-layer motif) ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(90% 120% at 88% -10%, rgba(22,184,102,.22) 0%, transparent 45%),
    radial-gradient(70% 90% at 10% 110%, rgba(22,184,102,.10) 0%, transparent 50%),
    linear-gradient(180deg, #12161d 0%, var(--ink) 100%);
  color: #e8eaef;
  padding: 100px 0 88px;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 10px);
  mask-image: linear-gradient(180deg, transparent, #000 40%);
}
.hero .wrap { position: relative; }
.hero h1 { color: #fff; max-width: 16ch; letter-spacing: -.025em; }
.hero p.lead { font-size: 1.22rem; color: #aeb4c0; max-width: 52ch; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600;
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: #9df0c1; margin-bottom: 18px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(22,184,102,.12); border: 1px solid rgba(22,184,102,.28);
}
.hero-slim { padding: 64px 0 52px; }
.hero-slim h1 { max-width: none; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
  text-decoration: none; line-height: 1.2;
  transition: transform .15s, box-shadow .15s, background-color .15s, color .15s;
}
.btn:active { transform: scale(.98); }
.btn-buy {
  background: var(--green); color: var(--green-ink);
  box-shadow: 0 3px 14px rgba(22, 184, 102, .4);
}
.btn-buy:hover { background: var(--green-deep); color: #fff; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(22, 184, 102, .45); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1.5px solid rgba(20, 24, 32, .22);
}
.btn-ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn-ghost-light:hover { border-color: var(--green); color: var(--green); }
.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- product grid (2 columns) ---------- */
.product-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
}
@media (max-width: 700px) { .product-grid { grid-template-columns: 1fr; } }

.product-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); border-color: var(--green-line); }
.product-media {
  aspect-ratio: 1 / 1; background: var(--paper-2); cursor: pointer;
  border: 0; padding: 0; width: 100%; display: block; overflow: hidden;
  position: relative;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.product-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.product-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.18rem;
  color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  letter-spacing: -.01em;
}
.product-name:hover { color: var(--green-deep); }
.product-price {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--green-deep);
  white-space: nowrap; background: var(--green-soft); padding: 3px 12px; border-radius: 999px;
}
.product-desc { color: var(--muted); font-size: .97rem; margin: 0; flex: 1; }
.product-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.product-actions .btn { flex: 1; min-width: 130px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(21, 23, 28, .55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); border-radius: var(--radius); max-width: 860px; width: 100%;
  max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lift);
  display: grid; grid-template-columns: 1fr 1fr;
  transform: translateY(12px) scale(.98); transition: transform .2s;
}
.modal-backdrop.open .modal { transform: none; }
@media (max-width: 700px) { .modal { grid-template-columns: 1fr; max-height: 92vh; } }
.modal-media { aspect-ratio: 1/1; background: var(--paper-2); }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-body { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.modal-body h3 { font-size: 1.5rem; margin: 0; }
.modal-price { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--green-deep); }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: var(--ink); color: #fff; border: 0; border-radius: 50%;
  width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer;
}
.qty-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.qty-stepper {
  display: inline-flex; align-items: center; border: 1.5px solid var(--line);
  border-radius: 999px; overflow: hidden; background: #fff;
}
.qty-stepper button {
  width: 38px; height: 38px; border: 0; background: none; font-size: 1.15rem;
  cursor: pointer; color: var(--ink); font-weight: 700;
}
.qty-stepper button:hover { background: var(--green-soft); }
.qty-stepper input {
  width: 44px; border: 0; text-align: center; font: inherit; font-weight: 700;
  -moz-appearance: textfield; appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- forms ---------- */
.form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; color: var(--ink); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; font: inherit; color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}
.field textarea { min-height: 130px; resize: vertical; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

.notice {
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: .95rem;
  border: 1px solid; margin: 0 0 16px;
}
.notice-ok { background: var(--green-soft); border-color: #86efac; color: #14532d; }
.notice-warn { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.notice-err { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }

/* ---------- cart ---------- */
.cart-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 820px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-lines { display: flex; flex-direction: column; gap: 14px; }
.cart-line {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.cart-line img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-line-name { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.cart-line-price { color: var(--muted); font-size: .92rem; }
.cart-line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cart-line-total { font-family: var(--font-display); font-weight: 700; }
.link-danger {
  background: none; border: 0; color: var(--danger); cursor: pointer;
  font: inherit; font-size: .88rem; padding: 0; text-decoration: underline;
}
.summary-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; position: sticky; top: 86px;
}
.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: .98rem; }
.summary-row.total {
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  border-top: 2px solid var(--ink); padding-top: 12px; margin-top: 12px; color: var(--ink);
}
.free-ship-note { font-size: .85rem; color: var(--green-deep); }

/* ---------- STL analyzer (custom page) ---------- */
.dropzone {
  border: 2.5px dashed #c9c6bc; border-radius: var(--radius); background: var(--card);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--green); background: var(--green-soft); }
.dropzone strong { font-family: var(--font-display); color: var(--ink); }

.viewer-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; margin-top: 24px; }
@media (max-width: 900px) { .viewer-layout { grid-template-columns: 1fr; } }
.viewer-panel {
  background: var(--ink); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-lift); position: relative;
}
#stl-canvas-holder { width: 100%; aspect-ratio: 4 / 3; }
#stl-canvas-holder canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer-hud {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.viewer-hud > * { pointer-events: auto; }
.hud-btn {
  background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .85rem; cursor: pointer;
  backdrop-filter: blur(4px);
}
.hud-btn:hover { border-color: var(--green); }
.hud-btn[aria-pressed="true"] { background: var(--green); color: #0c130e; border-color: var(--green); font-weight: 700; }
.hud-readout {
  background: rgba(0,0,0,.5); color: #a7f3d0; font-size: .85rem; border-radius: 999px;
  padding: 6px 14px; font-family: var(--font-display);
}
.viewer-controls { padding: 16px; display: grid; gap: 14px; background: var(--ink-2); }
.viewer-controls .ctl { display: grid; gap: 6px; }
.viewer-controls label { color: #cfd2d9; font-size: .85rem; font-weight: 700; }
.viewer-controls .ctl-row { display: flex; align-items: center; gap: 10px; }
.viewer-controls input[type="range"] { flex: 1; accent-color: var(--green); }
.viewer-controls input[type="number"] {
  width: 74px; padding: 6px 8px; border-radius: 8px; border: 1px solid #3a3f4b;
  background: var(--ink); color: #fff; font: inherit; font-size: .9rem;
}
.viewer-controls output { color: #a7f3d0; font-size: .85rem; min-width: 48px; text-align: right; }
.stretch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stretch-grid .ctl-row { flex-direction: column; align-items: stretch; gap: 4px; }
.stretch-grid span { color: #9096a3; font-size: .78rem; text-align: center; }

.estimate-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.estimate-rows { display: grid; gap: 10px; margin: 16px 0; }
.estimate-row { display: flex; justify-content: space-between; font-size: .97rem; gap: 12px; }
.estimate-row dt { color: var(--muted); margin: 0; }
.estimate-row dd { margin: 0; font-weight: 700; color: var(--ink); text-align: right; }
.estimate-price {
  background: var(--green-soft); border: 1px solid var(--green-line); border-radius: var(--radius-sm);
  padding: 14px 18px; display: flex; justify-content: space-between; align-items: center;
}
.estimate-price .amount { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--green-deep); }

/* ---------- about page ---------- */
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 34px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }
.about-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.about-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--green-line); }
.about-card h3 { letter-spacing: -.01em; }
.about-card .icon {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--green-soft), #cdeed9); color: var(--green-deep);
  margin-bottom: 16px; box-shadow: inset 0 0 0 1px var(--green-line);
}
.prose { max-width: 68ch; }
.prose p { margin-bottom: 1.2em; }
.prose h2 { letter-spacing: -.02em; }

/* Eyebrow label for light sections */
.section-kicker {
  display: inline-block; font-family: var(--font-display); font-weight: 700;
  font-size: .76rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--green-deep); margin-bottom: 12px;
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--ink); color: #9096a3; margin-top: 80px;
  padding: 52px 0 40px; font-size: .93rem;
  border-top: 1px solid var(--ink-3);
}
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.site-footer strong { letter-spacing: -.01em; }
.site-footer a { color: #cfd2d9; text-decoration: none; }
.site-footer a:hover { color: var(--green); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 200; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border: 1.5px solid var(--green); }
.toast.err { border: 1.5px solid var(--danger); }

/* ---------- scroll reveal (progressive enhancement) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}

/* ---------- misc ---------- */
.empty-state {
  text-align: center; padding: 56px 24px; background: var(--card);
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%; margin: 0 auto;
  border: 3px solid var(--line); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.badge {
  display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 700;
}
.badge-pending { background: #fef3c7; color: #78350f; }
.badge-paid { background: var(--green-soft); color: #14532d; }
.badge-shipped { background: #dbeafe; color: #1e3a8a; }
