/* maz3Designs — warm craftsman stylesheet.
 * Palette: cream paper, walnut ink, honey/amber/brass accents.
 * Type: Georgia (display + body) over a system-ui UI layer.
 */

:root {
  --bg: #f6eede;
  --bg-deep: #efe3cc;
  --paper: #fdf8ec;
  --ink: #33261a;
  --ink-soft: #6d5843;
  --walnut: #46311e;
  --wood: #7a5634;
  --honey: #b97f2a;
  --amber: #d99a3d;
  --brass: #a98a55;
  --line: #e0d0b2;
  --shadow: 0 1px 2px rgba(70, 49, 30, 0.08), 0 8px 24px -12px rgba(70, 49, 30, 0.25);
  --radius: 10px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--honey); text-underline-offset: 3px; }
a:hover { color: var(--walnut); }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--walnut);
  color: var(--paper);
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; color: var(--paper); }

.container {
  width: min(1100px, 100% - 3rem);
  margin-inline: auto;
}

/* ---------- Wordmark ---------- */

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--walnut);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}
.wordmark .three {
  display: inline-block;
  color: var(--paper);
  background: linear-gradient(160deg, var(--amber), var(--honey) 70%);
  border-radius: 0.28em;
  padding: 0 0.14em;
  margin: 0 0.06em;
  transform: rotate(-6deg) translateY(-0.04em);
  box-shadow: inset 0 -0.09em 0 rgba(70, 49, 30, 0.35), 0 1px 2px rgba(70, 49, 30, 0.25);
  border: none;
  font: inherit;
  cursor: pointer;
  line-height: 1.25;
  transition: transform 0.15s ease;
}
.wordmark .three:hover { transform: rotate(2deg) translateY(-0.08em); }
.wordmark .three:active { transform: rotate(-10deg) scale(0.94); }
.wordmark .three.jolt { animation: three-jolt 0.35s ease; }
@keyframes three-jolt {
  0% { transform: rotate(-6deg) scale(1); }
  40% { transform: rotate(8deg) scale(1.25); }
  100% { transform: rotate(-6deg) scale(1); }
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.8rem;
  flex-wrap: wrap;
}
.site-header .wordmark { font-size: 1.45rem; }

.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
}
.site-nav a:hover { color: var(--walnut); background: var(--bg-deep); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(5rem, 12vw, 9rem) clamp(4rem, 10vw, 7rem);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper), var(--bg));
}
.hero-maze {
  position: absolute;
  inset: -2rem;
  opacity: 0.5;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 75% 90% at 78% 40%, black 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 90% at 78% 40%, black 10%, transparent 72%);
}
.hero-maze svg { width: 100%; height: 100%; }
.hero .container { position: relative; }
.hero-kicker {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--honey);
  margin: 0 0 1.2rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 1.4rem;
  max-width: 16ch;
  color: var(--walnut);
}
.hero p.lede {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 2.4rem;
}
.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 2px solid var(--walnut);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { background: var(--walnut); color: var(--paper); }
.btn-primary:hover { color: var(--paper); }
.btn-ghost { background: transparent; color: var(--walnut); }
.btn-ghost:hover { color: var(--walnut); }

/* ---------- Sections ---------- */

.section { padding-block: clamp(4rem, 9vw, 6.5rem); }
.section-alt { background: var(--paper); border-block: 1px solid var(--line); }

.section-head { margin-bottom: clamp(2.2rem, 5vw, 3.4rem); }
.section-head .kicker {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--honey);
  margin: 0 0 0.6rem;
}
.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.15;
  margin: 0;
  color: var(--walnut);
}
.section-head p.sub {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  max-width: var(--measure);
  font-size: 1.1rem;
}

/* Maze divider strip between sections */
.maze-divider {
  height: 44px;
  overflow: hidden;
  opacity: 0.35;
  display: flex;
  justify-content: center;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 20%, black 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 20%, black 80%, transparent);
}
.maze-divider svg { height: 100%; width: auto; }

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(255px, 100%), 1fr));
  gap: 1.6rem;
}
.piece {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.piece:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(70,49,30,0.1), 0 16px 32px -12px rgba(70,49,30,0.3); }
.piece-art { position: relative; aspect-ratio: 1; background: var(--bg-deep); }
.piece-art svg, .piece-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.piece-chip {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: color-mix(in srgb, var(--walnut) 82%, transparent);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}
.piece-body { padding: 1.1rem 1.2rem 1.3rem; }
.piece-body h3 { margin: 0 0 0.2rem; font-size: 1.15rem; color: var(--walnut); }

/* The title is a button whose ::after covers the whole card, so the card is
   clickable while the heading stays a real heading for screen readers. */
.piece { position: relative; }
.piece-open {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.piece-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.piece:hover .piece-open { color: var(--honey); }
.piece:has(.piece-open:focus-visible) { outline: 3px solid var(--amber); outline-offset: 3px; }
.piece-open:focus-visible { outline: none; }

/* ---------- Piece lightbox ---------- */

.piece-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(900px, 94vw);
  max-height: 92vh;
  overflow: visible;
  color: var(--ink);
}
.piece-dialog::backdrop { background: rgba(40, 27, 15, 0.72); backdrop-filter: blur(3px); }
.pd-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(40, 27, 15, 0.6);
  max-height: 92vh;
}
@media (max-width: 720px) {
  .pd-panel { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
}
.pd-art { background: var(--bg-deep); aspect-ratio: 1; }
.pd-art svg, .pd-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-body { padding: clamp(1.4rem, 3vw, 2.2rem); display: flex; flex-direction: column; justify-content: center; }
.pd-material {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.5rem;
}
.pd-title { margin: 0 0 0.7rem; font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--walnut); line-height: 1.2; }
.pd-caption { margin: 0; color: var(--ink-soft); }
.pd-note {
  margin: 1.1rem 0 0;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--brass);
  border-left: 3px solid var(--line);
  padding-left: 0.8rem;
}
.pd-nav { display: flex; align-items: center; gap: 1rem; margin-top: 1.8rem; flex-wrap: wrap; }
.pd-nav button {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--walnut);
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}
.pd-nav button:hover { border-color: var(--amber); color: var(--honey); }
.pd-count { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); }
.pd-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  z-index: 2;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--paper);
  background: color-mix(in srgb, var(--walnut) 78%, transparent);
  border: none;
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  cursor: pointer;
}
.pd-close:hover { background: var(--walnut); }
.piece-material {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.55rem;
}
.piece-body p { margin: 0; font-size: 0.95rem; color: var(--ink-soft); line-height: 1.6; }

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
}
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }
.about-text p { max-width: var(--measure); margin: 0 0 1.2rem; }
.about-note {
  border-left: 3px solid var(--amber);
  padding: 0.4rem 0 0.4rem 1.2rem;
  margin: 1.8rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 52ch;
}
.about-plaque {
  background: linear-gradient(150deg, #8a6238, #5d3f22 60%, #4a3018);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 235, 200, 0.25);
  border: 1px solid #3c2814;
}
.about-plaque .plaque-inner {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 1rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}
.about-plaque svg { width: 100%; height: auto; display: block; }
.about-plaque figcaption {
  font-family: var(--sans);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e9cf9e;
  margin-top: 0.9rem;
}

/* ---------- Custom pieces / form ---------- */

.custom-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 4rem);
  align-items: start;
}
@media (max-width: 800px) { .custom-grid { grid-template-columns: 1fr; } }
.custom-copy p { max-width: 48ch; }
.custom-copy .direct-line { margin-top: 1.6rem; font-size: 0.98rem; color: var(--ink-soft); }

.request-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 4vw, 2.2rem);
  box-shadow: var(--shadow);
}
.form-row { margin-bottom: 1.2rem; }
.form-row label {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.form-row .optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--brass); }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: 3px solid var(--amber);
  outline-offset: 1px;
  border-color: var(--amber);
}
.form-row textarea { resize: vertical; min-height: 7.5rem; }
.form-note {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 1rem 0 0;
}
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .form-two { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  padding-block: 2.6rem;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer .wordmark { font-size: 1.2rem; }
.site-footer p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- 404 ---------- */

.dead-end {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}
.dead-end .maze-404 { width: min(320px, 78vw); margin: 2rem auto; }
.dead-end .maze-404 canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none; /* dragging traces the maze instead of scrolling the page */
  cursor: crosshair;
  border-radius: var(--radius);
}
.dead-end .maze-404 canvas:focus-visible { outline: 3px solid var(--amber); outline-offset: 6px; }
.dead-end h1 { color: var(--walnut); font-size: clamp(2rem, 6vw, 3rem); margin: 1.4rem 0 0.6rem; }
.dead-end p { color: var(--ink-soft); max-width: 42ch; margin: 0 auto 2rem; }
.dead-end .maze-404-hint {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--brass);
  margin: 1rem auto 0;
  min-height: 2.6em;
}
.dead-end .maze-404-hint.solved { color: var(--honey); font-weight: 700; }

/* ---------- Easter egg transition ---------- */

.descend-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0b0704;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}
.descend-overlay.active { opacity: 1; pointer-events: auto; }
.descend-overlay .descend-text {
  color: #e9cf9e;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-style: italic;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s ease 0.5s, transform 0.8s ease 0.5s;
  text-align: center;
  padding: 0 1.5rem;
}
.descend-overlay.active .descend-text { opacity: 1; transform: none; }
