:root {
  color-scheme: light;
  --ink: #201c18;
  --muted: #655d54;
  --paper: rgba(250, 247, 239, 0.92);
  --paper-edge: rgba(87, 65, 43, 0.28);
  --wine: #5b1e26;
  --wine-dark: #3f1219;
  --brass: #9a7136;
  --shadow: 0 26px 80px rgba(10, 7, 5, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #14110f;
  font-size: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  background-image:
    linear-gradient(rgba(10, 8, 7, 0.04), rgba(10, 8, 7, 0.1)),
    url("background-v3.webp");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

button,
summary {
  font: inherit;
}

.site-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.25rem;
}

.page-panel {
  width: min(100%, 42rem);
  margin: 1.25rem auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 0.35rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.landing-panel {
  text-align: center;
  padding-block: clamp(2.75rem, 9vw, 5.5rem);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--wine);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 4.15rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.puzzle-title {
  margin-top: 0.75rem;
  font-size: clamp(1.65rem, 6vw, 2.75rem);
  line-height: 1.12;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: min(17rem, 68%);
  margin: 1.5rem auto;
  color: var(--brass);
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: currentColor;
  opacity: 0.75;
}

.ornament span {
  width: 0.48rem;
  height: 0.48rem;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.intro {
  max-width: 35rem;
  margin: 0 auto;
  color: #403a34;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
}

.instruction {
  margin: 1.25rem 0 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-style: italic;
}

.help-stack {
  display: grid;
  gap: 0.85rem;
}

.help-item {
  overflow: clip;
  border: 1px solid rgba(81, 59, 38, 0.26);
  border-radius: 0.25rem;
  background: rgba(255, 253, 248, 0.82);
}

.help-item summary,
.solution-trigger {
  position: relative;
  width: 100%;
  min-height: 3.65rem;
  padding: 1rem 3.15rem 1rem 1.1rem;
  border: 0;
  color: var(--wine-dark);
  background: transparent;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.help-item summary::-webkit-details-marker {
  display: none;
}

.help-item summary::after,
.solution-trigger::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 1.15rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-52%);
}

.help-item[open] summary::after,
.solution-trigger[aria-expanded="true"]::after {
  content: "−";
}

.help-item summary:hover,
.help-item summary:focus-visible,
.solution-trigger:hover,
.solution-trigger:focus-visible {
  background: rgba(154, 113, 54, 0.1);
}

.help-item summary:focus-visible,
.solution-trigger:focus-visible,
.dialog-button:focus-visible {
  outline: 3px solid rgba(91, 30, 38, 0.48);
  outline-offset: -3px;
}

.help-copy {
  padding: 0 1.1rem 1.25rem;
  border-top: 1px solid rgba(81, 59, 38, 0.14);
  font-size: 1.05rem;
}

.help-copy p {
  margin: 1rem 0 0;
}

.answer {
  padding-top: 0.9rem;
  border-top: 1px solid rgba(154, 113, 54, 0.42);
}

.answer strong {
  color: var(--wine-dark);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-footer {
  margin-top: 2rem;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

dialog {
  width: min(calc(100% - 2rem), 30rem);
  padding: 0;
  border: 1px solid rgba(81, 59, 38, 0.35);
  border-radius: 0.35rem;
  color: var(--ink);
  background: #faf7ef;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.52);
}

dialog::backdrop {
  background: rgba(12, 9, 7, 0.72);
  backdrop-filter: blur(3px);
}

body.dialog-open {
  overflow: hidden;
}

dialog.dialog-fallback {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(12, 9, 7, 0.72);
  backdrop-filter: blur(3px);
}

dialog.dialog-fallback .dialog-content {
  width: min(calc(100% - 2rem), 30rem);
  border: 1px solid rgba(81, 59, 38, 0.35);
  border-radius: 0.35rem;
  background: #faf7ef;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.52);
}

.dialog-content {
  padding: 1.65rem;
}

.dialog-content h2 {
  margin: 0 0 0.65rem;
  font-size: 1.55rem;
  line-height: 1.2;
}

.dialog-content p {
  margin: 0;
  color: var(--muted);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.dialog-button {
  min-height: 3rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--wine);
  border-radius: 0.2rem;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  cursor: pointer;
}

.dialog-button.primary {
  color: #fffaf0;
  background: var(--wine);
}

.dialog-button.secondary {
  color: var(--wine);
  background: transparent;
}

.dialog-button:hover {
  filter: brightness(0.92);
}

[hidden] {
  display: none !important;
}

@media (max-width: 34rem) {
  .site-shell {
    align-items: start;
    padding: 0.8rem;
  }

  .page-panel {
    margin: 0.8rem auto;
    padding: 1.5rem 1.1rem 1.75rem;
  }

  .landing-panel {
    min-height: calc(100vh - 1.6rem);
    display: grid;
    align-content: center;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
