/* Audience: older Americans. Large type, high contrast, simple layout (spec §8). */
:root {
  --ink: #1a1a1a;
  --paper: #ffffff;
  --accent: #b3541e;
  --accent-dark: #8f3f12;
  --steel: #5c6670;
  --line: #d8d4cf;
  --ok-bg: #f6f4f1;
}

* { box-sizing: border-box; }
/* Author display rules (e.g. the flex panes) must never resurrect an
   element the script hid via the hidden attribute. */
[hidden] { display: none !important; }

/* App shell: header / content / step bar share exactly one viewport
   (100dvh tracks mobile browser chrome). The content row flexes; the sign
   preview sizes itself to whatever space is actually left, so every step
   fits any screen height without scrolling. Content views scroll INSIDE
   the content row — scrolling moves through content, never navigation. */
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

main {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 16px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  border-bottom: 3px solid var(--ink);
}

.logo {
  margin: 0;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 0.5px;
}
.logo span { color: var(--accent); }

.usa-note { margin: 0; font-size: 18px; color: var(--steel); }

.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-link {
  font: inherit;
  font-size: 19px;
  background: none;
  border: none;
  border-bottom: 4px solid transparent;
  color: var(--ink);
  padding: 4px 10px 2px;
  cursor: pointer;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--accent-dark); }
.nav-link[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
  font-weight: bold;
}
#step-bar[hidden] { display: none; }

.hero { text-align: center; padding: 6px 0 2px; }
.hero h1 { font-size: 36px; line-height: 1.15; margin: 0 0 6px; }
.hero .sub { font-size: 20px; max-width: 620px; margin: 0 auto; }
/* Phones: trim the headline and input padding (body text unchanged) so the
   whole first step still fits one screen. */
@media (max-width: 480px) {
  .hero h1 { font-size: 29px; }
  textarea, input[type="text"] { padding: 11px; }
}

/* Wizard panes: one on screen at a time, no scrolling between steps. The
   step bar is fixed at the bottom; body padding keeps it clear of content. */
/* Panes that show the sign fill the content row; the preview slot absorbs
   all slack and the script sizes the image to it. */
.pane { padding-top: 10px; }
.pane h2 { font-size: 28px; margin: 4px 0 12px; }
#pane-preview, #pane-holes, #pane-buy, #result {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#pane-preview, #pane-holes, #pane-buy { height: 100%; }
#result { flex: 1 1 0; }
.preview-slot {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#preview-area {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#preview-area .preview-wrap { min-height: 0; }
.pane-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
}
/* In a nav row the buttons sit side by side and size to their labels,
   overriding the stacked full-width default. */
.pane-nav .big-btn,
.pane-nav .secondary-btn {
  display: inline-block;
  width: auto;
  max-width: none;
  margin: 0;
  flex: none;
  font-size: 22px;
  padding: 14px 26px;
}

#step-bar {
  flex: none;
  display: flex;
  justify-content: space-around;
  background: var(--paper);
  border-top: 3px solid var(--ink);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.step-tab {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 2px 10px;
}
.step-tab:disabled { color: var(--line); cursor: default; }
.step-tab:disabled .step-dot { background: var(--line); }
.step-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step-tab[aria-current="step"] .step-dot { background: var(--accent); }
.step-tab[aria-current="step"] .step-name { color: var(--accent-dark); font-weight: bold; }
.step-tab.done .step-dot { background: #2f6f4f; }
.step-name { font-size: 16px; }

textarea, input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 22px;
  padding: 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
}
textarea { resize: vertical; }
textarea:focus, input[type="text"]:focus { outline: 4px solid var(--accent); outline-offset: 2px; }

.field-label {
  display: block;
  font-size: 21px;
  font-weight: bold;
  margin: 10px 0 6px;
}

.hint { font-size: 18px; color: var(--steel); margin: 6px 0 10px; }

.text-link {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-dark);
  text-decoration: underline;
  cursor: pointer;
}

.sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.size-card {
  font: inherit;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
}
.size-card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--ok-bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.size-card .size-label { font-size: 24px; font-weight: bold; display: block; }
.size-card .size-note { font-size: 17px; color: var(--steel); display: block; }
.size-card .size-price { font-size: 26px; display: block; margin-top: 6px; }

.big-btn {
  font: inherit;
  font-size: 26px;
  font-weight: bold;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 20px 36px;
  cursor: pointer;
  display: block;
  width: 100%;
  max-width: 460px;
  margin: 10px auto;
}
.big-btn:hover, .big-btn:focus { background: var(--accent-dark); }
.big-btn:disabled { background: var(--steel); cursor: not-allowed; }

.secondary-btn {
  font: inherit;
  font-size: 22px;
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 14px 28px;
  cursor: pointer;
  display: block;
  width: 100%;
  max-width: 460px;
  margin: 10px auto;
}
.secondary-btn:disabled { color: var(--steel); border-color: var(--line); cursor: not-allowed; }

.working { text-align: center; padding: 24px 0; }
.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border: 6px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  border: 3px solid #a33;
  background: #fdf1f0;
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 20px;
  margin: 16px 0;
}

#result { text-align: center; }
#preview-img { border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.preview-wrap { position: relative; display: inline-block; max-width: 100%; }
/* The image's max-height is set by script to the slot's measured free
   space (fitPreview) — no viewport math, works at any screen size. The
   wrap shrink-wraps the img, keeping the hole overlay exactly aligned. */
.preview-wrap img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
}
/* While editing holes the banner explains the preview; drop the cut note so
   the pane still fits above the step bar. */
.preview-wrap.editing ~ .preview-note { display: none; }
/* Editing mode must be unmissable: the banner above announces it, and the
   sign itself gets a dashed accent frame while taps are live. */
.preview-wrap.editing {
  cursor: crosshair;
  outline: 4px dashed var(--accent);
  outline-offset: 3px;
}
.hole-edit-banner {
  align-self: stretch;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  font-weight: bold;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  margin-bottom: 8px;
}
.hole-layer { position: absolute; inset: 0; }
/* A marker is a RING at the true hole diameter: transparent middle so you
   see the metal it would punch through; the applied preview shows the real
   hole. Sized inline from the preview transform. */
.hole-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  cursor: pointer;
  box-sizing: border-box;
}
.hole-marker::before {
  /* generous invisible tap target */
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}
.preview-note { font-size: 18px; color: var(--steel); }
.design-warning {
  border: 3px solid #c9a227;
  background: #fdf8e7;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 19px;
  text-align: left;
}

.content-view { margin-top: 24px; }
.content-view h2 { font-size: 28px; }

.about-me { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; }
.about-me > div { flex: 1 1 320px; }
.about-me > div p:first-child { margin-top: 0; }
.about-photo {
  width: 230px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
details { border-bottom: 2px solid var(--line); padding: 10px 0; }
summary { font-size: 22px; font-weight: bold; cursor: pointer; padding: 8px 0; }
details p { font-size: 20px; }

/* The footer belongs to the scrollable content views; the wizard steps are
   app screens that end at the step bar, with nothing below to scroll to. */
footer { display: none; text-align: center; padding: 30px 20px 40px; border-top: 3px solid var(--ink); margin-top: 40px; }
body.viewing-content footer { display: block; }
footer a { color: var(--accent-dark); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Order status page */
.status-list { list-style: none; padding: 0; max-width: 460px; margin: 30px auto; text-align: left; }
.status-list li { padding: 12px 0 12px 44px; position: relative; font-size: 22px; color: var(--steel); }
.status-list li::before {
  content: '';
  position: absolute; left: 8px; top: 18px;
  width: 18px; height: 18px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff;
}
.status-list li.done { color: var(--ink); }
.status-list li.done::before { background: var(--accent); border-color: var(--accent); }
.tracking { font-size: 22px; }

/* Progress bar shown while the design is being made. */
.progress-track {
  max-width: 420px;
  height: 18px;
  margin: 16px auto 8px;
  border-radius: 9px;
  background: #e4e0d8;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 5%;
  border-radius: 9px;
  background: #2f6f4f;
  transition: width 0.8s ease;
}
.progress-stage {
  font-size: 1.15rem;
  color: #4a463f;
  margin: 4px 0 0;
}

/* Inspiration gallery: real outputs, tap to start from one. */
#view-gallery h2 { text-align: center; }
#view-gallery .sub { text-align: center; }
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media (min-width: 720px) {
  .gallery { grid-template-columns: repeat(4, 1fr); }
}
.gallery-card {
  border: 2px solid #d8d2c6;
  border-radius: 10px;
  background: #fff;
  padding: 0 0 8px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.gallery-card:hover, .gallery-card:focus-visible {
  border-color: #2f6f4f;
  transform: translateY(-2px);
}
.gallery-card img {
  width: 100%;
  height: auto;
  display: block;
  background: #eceae4;
}
.gallery-card .gallery-caption {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #37332c;
  padding: 8px 8px 0;
}

/* Dashed guide connecting mounting holes that share a row. */
.hole-guide {
  position: absolute;
  border-top: 3px dashed rgba(47, 111, 79, 0.75);
  transform: translateY(-50%);
  pointer-events: none;
}
.hole-guide-v {
  position: absolute;
  border-left: 3px dashed rgba(47, 111, 79, 0.75);
  transform: translateX(-50%);
  pointer-events: none;
}

.order-preview { max-width: 100%; border-radius: 10px; }
