/* ============================================
   find calvin! — tokens
   bg #050505 · ink #EDEAE2 · muted #8A8A88
   link #4C5FE0 (cold hyperlink blue)
   clue #C81E1E (evidence red) · slate #46484C
  display: Times New Roman
  body: Times New Roman
   ============================================ */

:root {
  --bg: #050505;
  --ink: #EDEAE2;
  --muted: #8A8A88;
  --link: #5A6CE8;
  --link-hover: #8C98F2;
  --clue: #C81E1E;
  --clue-dim: #8F1616;
  --slate: #3E4045;
  --focus: #E8C84C;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

button, input { font-family: inherit; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px 0;
}

.sitenav {
  font-size: 1.05rem;
}

.sitenav .sep {
  color: var(--muted);
  margin: 0 6px;
}

.helpbtn {
  width: 38px;
  height: 38px;
  flex: none;
  background: #A8A8A8;
  color: #1a1a1a;
  border: none;
  font-family: inherit;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.helpbtn:hover {
  background: #c2c2c2;
  color: #1a1a1a;
  text-decoration: none;
}

/* ---------- main content ---------- */

.page {
  padding: 4px 20px 40px;
  max-width: 900px;
}

.pagetitle {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.9rem;
  margin: 4px 0 8px;
}

.intro {
  font-size: 0.95rem;
  line-height: 1.35;
  color: #CFCCC4;
  max-width: 56ch;
  margin: 0 0 24px;
}

.clues-heading {
  font-family: inherit;
  font-weight: 500;
  font-size: 1.8rem;
  margin: 0 0 12px;
}

/* ---------- clue cards ---------- */

.clue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-width: 640px;
}

.clue-card {
  display: flex;
  flex-direction: column;
  background: var(--clue);
  min-height: 180px;
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease;
}

.clue-card:hover { transform: translateY(-3px); }

.clue-card .clue-number {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.75);
}

.clue-thumb {
  flex: 1;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--clue-dim);
}

.clue-thumb-fallback {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  font-style: italic;
}

.clue-titlebar {
  background: var(--slate);
  padding: 10px 12px;
}

.clue-titlebar a {
  color: var(--ink);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  display: block;
}

.clue-titlebar a:hover {
  color: var(--focus);
  text-decoration: none;
}

.clue-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- locked clue state ---------- */

.clue-card--locked .clue-thumb,
.clue-card--locked .clue-thumb-fallback {
  filter: brightness(0.6);
}

.clue-lock {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.95rem;
}

.clue-title-btn {
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
}

.clue-title-btn:hover { color: var(--focus); }

/* ---------- code popup ---------- */

.code-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.code-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
}

.code-modal-box {
  position: relative;
  background: #121214;
  border: 1px solid var(--slate);
  padding: 28px 26px;
  width: 300px;
  max-width: calc(100vw - 40px);
}

.code-modal-box h3 {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0 0 8px;
}

.code-modal-sub {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 18px;
}

.code-input {
  width: 100%;
  background: #050505;
  border: 1px solid var(--slate);
  color: var(--ink);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 10px 8px;
  font-family: inherit;
}

.code-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.code-error {
  color: #F06060;
  font-size: 0.82rem;
  margin: 10px 0 0;
}

.code-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.code-cancel, .code-submit {
  border: none;
  padding: 9px 16px;
  font-size: 0.85rem;
  cursor: pointer;
}

.code-cancel {
  background: transparent;
  color: var(--muted);
}

.code-cancel:hover { color: var(--ink); }

.code-submit {
  background: var(--clue);
  color: var(--ink);
}

.code-submit:hover { background: #E02323; }

/* ---------- corner polaroid ---------- */

.corner-polaroid {
  position: fixed;
  right: 40px;
  bottom: 40px;
  width: 320px;
  height: 220px;
  background-color: transparent;
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.placeholder-label {
  font-family: inherit;
  font-style: italic;
  font-weight: 600;
  font-size: 1.8rem;
  color: rgba(255,255,255,0.85);
  transform: rotate(-3deg);
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .corner-polaroid { display: none; }
  .clue-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .pagetitle { font-size: 1.5rem; }
  .clues-heading { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .clue-card { transition: none; }
}

/* ---------- not-found page ---------- */

.notfound-page {
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 24px 80px;
  max-width: 640px;
}

.notfound-code {
  font-family: inherit;
  font-style: italic;
  font-weight: 600;
  font-size: 5rem;
  color: var(--clue);
  line-height: 1;
  margin: 0 0 8px;
}

.notfound-title {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.9rem;
  margin: 0 0 14px;
}

.notfound-copy {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #CFCCC4;
  max-width: 52ch;
  margin: 0 0 28px;
}

.notfound-home {
  display: inline-block;
  border: 1px solid var(--slate);
  padding: 10px 18px;
  font-size: 0.9rem;
  color: var(--ink);
}

.notfound-home:hover {
  border-color: var(--focus);
  color: var(--focus);
  text-decoration: none;
}