:root {
  color-scheme: dark;
  --fg: #f2f2f2;
  --muted: #8a8a8a;
  --line: rgba(255, 255, 255, 0.28);
  --accent: #bfe6ff;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: #000;
  color: var(--fg);
}

body {
  display: grid;
  grid-template-rows: 1fr auto;   /* entry UI in the middle, projects along the bottom */
  place-items: center;
  min-height: 100svh;
  padding: 0 16px;
  overflow-x: hidden;
  overflow-y: auto;               /* only ever scrolls on very short screens */
  font: 16px/1.5 var(--mono);
}

/* background canvas (drawn by js/background.js) */
#field {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100lvh;   /* stays put when phone browser bars show and hide */
}

/* top-left corner: "Site by Jonathon Holt", the secrets menu, and the
   welcome message (js/secrets-menu.js) */
.corner {
  position: fixed;
  top: max(1.25rem, env(safe-area-inset-top));
  left: max(1.5rem, env(safe-area-inset-left));
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: 0.15rem;
  max-width: min(24rem, calc(100vw - 3rem));
}

.byline {
  margin: 0;
  color: #fff;
  font: 500 0.85rem / 1 var(--mono);
  letter-spacing: 0.04em;
}

.secrets-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;              /* comfortable tap target; the text itself stays small */
  margin-left: -0.6rem;
  padding: 0 0.6rem;
  color: var(--muted);
  font: 400 0.7rem / 1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.secrets-toggle:hover,
.secrets-toggle:focus-visible {
  color: #fff;
}

.secrets-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.secrets-caret {
  display: inline-block;
  transition: transform 0.2s;
}

.secrets-toggle[aria-expanded="true"] .secrets-caret {
  transform: rotate(90deg);
}

.secrets-score {
  display: inline-block;
  color: #fff;
  letter-spacing: 0.08em;
}

.secrets.complete .secrets-score {
  color: #e8b84b;
}

.secrets.pulse .secrets-score {
  animation: bump 0.5s ease-out;
}

.secrets-list {
  display: grid;
  gap: 0.5rem;
  min-width: 15rem;
  margin: 0.1rem 0 0;
  padding: 0.75rem 0.9rem;
  list-style: none;
  font: 0.78rem / 1.3 var(--mono);
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.secrets-list[hidden] {
  display: none;
}

.secrets-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--muted);
}

.secrets-list .mark {
  width: 1ch;
  text-align: center;
}

.secrets-list li.unlocked {
  color: #fff;
}

.secrets-list li.unlocked .mark {
  color: #4ade80;
}

.secrets-list .secret-note {
  color: var(--muted);
  font-size: 0.7rem;
}

.welcome {
  margin: 0.2rem 0 0;
  padding: 0.55rem 0.8rem;
  color: #fff;
  font: 0.8rem / 1.5 var(--mono);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
}

.welcome.show {
  opacity: 1;
  transform: none;
}

.welcome[hidden] {
  display: none;
}

/* click counter, top-right (js/clicks.js); clicks pass straight through it */
.clicks {
  position: fixed;
  top: max(1.25rem, env(safe-area-inset-top));
  right: max(1.5rem, env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
  color: #fff;
  font: 500 0.85rem / 1 var(--mono);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
}

.clicks.show {
  opacity: 1;
  transform: none;
}

.clicks-label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.clicks-count {
  display: inline-block;
  min-width: 2ch;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.clicks.bump .clicks-count {
  animation: bump 0.25s ease-out;
}

@keyframes bump {
  from { transform: scale(1.35); color: var(--accent); }
  to   { transform: scale(1); }
}

/* short screens (landscape phones): keep the content clear of the byline */
@media (max-height: 480px) {
  body { padding-top: 5.25rem; }
  /* the welcome message sits beside the byline instead of under it */
  .welcome {
    position: absolute;
    top: -0.4rem;
    left: 14rem;
    width: calc(100vw - 17.5rem);
    margin: 0;
  }
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 30rem;
  text-align: center;
}

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

.hint {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.code {
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 2.5vw, 0.875rem);
}

.digit {
  width: clamp(3rem, 17vw, 4.25rem);
  height: clamp(3.75rem, 21vw, 5.25rem);
  padding: 0;
  background: #000;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  caret-color: var(--accent);
  text-align: center;
  font: 500 clamp(1.75rem, 8vw, 2.5rem) var(--mono);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(150, 215, 255, 0.16), 0 0 28px rgba(150, 215, 255, 0.18);
}

#response {
  max-width: 26rem;
  min-height: 3.4em;
  margin: 1.5rem auto 0;
  color: #e8e8e8;
  font-size: 1.125rem;
  text-transform: lowercase;   /* remove this line to show responses as written */
  opacity: 0;
}

#response.show {
  animation: rise 0.45s ease-out forwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── projects ─────────────────────────────────────────────────── */
.projects {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 36rem;
  padding: 0 0 max(1.75rem, env(safe-area-inset-bottom));
}

.projects-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.25rem 0.85rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.projects-head h2 {
  margin: 0;
  font: inherit;
}

.projects-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.projects-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.projects ul {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* a project card: logo | text  (featured cards add a mini map on the right) */
.project {
  --mx: 50%;
  --my: 50%;
  --gold: 232, 184, 75;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;   /* text | logo */
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.25rem;
  color: var(--fg);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)), #050505;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
}

.project.featured {
  border-color: rgba(var(--gold), 0.22);   /* a hint of gold marks the featured project */
}

/* spotlight: gold light that follows the cursor along the border (js/spotlight.js) */
.project::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx) var(--my),
    rgba(var(--gold), 0.95), rgba(var(--gold), 0.18) 45%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* ...and a faint wash of the same light inside the card */
.project::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgba(var(--gold), 0.09), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.project:hover,
.project:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 50px -24px rgba(var(--gold), 0.35);
}

.project:hover::before,
.project:hover::after,
.project:focus-visible::before,
.project:focus-visible::after {
  opacity: 1;
}

.project:focus-visible {
  outline: 2px solid rgba(var(--gold), 0.9);
  outline-offset: 4px;
}

.project-logo {
  display: block;
  width: 80px;
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(var(--gold), 0.28));
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project:hover .project-logo,
.project:focus-visible .project-logo {
  transform: scale(1.05) rotate(-3deg);
}

.project-body {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.project-name {
  color: #f6f6f2;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.project-url {
  color: #cdb173;
  font-size: 0.78rem;
}

.project-arrow {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project:hover .project-arrow,
.project:focus-visible .project-arrow {
  transform: translate(2px, -2px);
}

.project-desc {
  margin-top: 0.15rem;
  color: #9b9b96;
  font-size: 0.78rem;
  line-height: 1.45;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.5rem;
  color: #b9b9b4;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.tag-live {
  color: #b8f5cf;
  border-color: rgba(74, 222, 128, 0.3);
}

.tag-live::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  animation: live 2.4s ease-out infinite;
}

@keyframes live {
  0%       { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

@media (max-width: 560px) {
  .project-logo { align-self: start; width: 56px; }
}

/* trademark notice under the projects list */
.projects-note {
  margin: 0.7rem 0.25rem 0;
  color: #85857f;
  font-size: 0.62rem;
  line-height: 1.5;
}

/* the hidden spot (js/secret.js): invisible, no cursor change, no hint */
.secret {
  position: fixed;
  z-index: 2;
}

/* "Found It!" overlay, shown for a few seconds when the spot is clicked */
.found {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0 16px;
  pointer-events: none;   /* never blocks the digit boxes underneath */
  opacity: 0;
}

.found span {
  font: 800 clamp(3.5rem, 15vw, 10rem) / 1 var(--mono);
  letter-spacing: -0.04em;
  text-align: center;
  color: transparent;
  background: linear-gradient(180deg, #fff3b0 0%, #ffb02e 42%, #ff3d1f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(255, 80, 20, 0.65));
}

.found.show {
  animation: found 3.4s ease-out forwards;
}

/* the cold spot (js/secret.js): invisible too */
.cold-spot {
  position: fixed;
  z-index: 1;
}

/* the icy corner that forms while the cold spot is hovered (drawn by
   js/background.js); above the corner text so it frosts over it */
.ice-corner {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.ice-corner[hidden] {
  display: none;
}

/* "Colder.....": same type and animation as "Hot!", frosted (a touch smaller so
   its eleven characters fit a phone screen) */
.colder span {
  font-size: clamp(3rem, 13vw, 9rem);
  background: linear-gradient(180deg, #ffffff 0%, #e4f6ff 38%, #a8dcff 70%, #6cbcf2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 24px rgba(150, 215, 255, 0.75));
}

/* "You did it": same type and animation as "Hot!", in blue */
.did-it span {
  background: linear-gradient(180deg, #e6f4ff 0%, #6ec1ff 45%, #2a6cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(60, 140, 255, 0.65));
}

@keyframes found {
  0%   { opacity: 0; transform: scale(0.6); }
  8%   { opacity: 1; transform: scale(1.08); }
  14%  { opacity: 1; transform: scale(1); }
  78%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

@keyframes found-calm {
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  78%  { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #response.show { animation: none; opacity: 1; }
  .digit, .project, .project-arrow, .project-logo { transition: none; }
  .project:hover, .project:focus-visible,
  .project:hover .project-logo, .project:focus-visible .project-logo { transform: none; }
  .tag-live::before { animation: none; }
  .found.show { animation-name: found-calm; }
  .clicks, .welcome, .secrets-caret { transition: none; }
  .secrets.pulse .secrets-score { animation: none; }
  .clicks.bump .clicks-count { animation: none; }
}
