/* The Six Degrees of DAKPluto
   Palette and motifs come from the logo mark: navy ground, gold rings and
   reel dots, cream lettering, and a red film strip that only ever means
   "these people are connected". */

:root {
  --navy: #0e0f1a;        /* page ground */
  --booth: #171a2b;       /* raised surfaces */
  --booth-2: #1f2338;     /* menus */
  --rule: #343852;        /* quiet borders */
  --gold: #e9b949;
  --gold-soft: rgba(233, 185, 73, 0.35);
  --gold-wash: rgba(233, 185, 73, 0.12); /* highlighted menu rows */
  --gold-hover: #f2c766;
  --cream: #f4e9d0;
  --slate: #9a98ae;       /* secondary text */
  --red: #e5502b;         /* error markers */
  --film: var(--red);     /* the film strip */
  --placeholder: #6a6b85;
  --scrim: rgba(14, 15, 26, 0.94);

  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  --deco: "Limelight", Georgia, serif;
  --text: "Jost", "Futura", "Century Gothic", sans-serif;

  --radius: 6px;
  --node: 56px;           /* person node diameter on a path */
  --strip: 15px;          /* film strip width, as in the mark */
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--navy);
  color: var(--cream);
  font: 400 17px/1.55 var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--gold-soft); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold); text-decoration-color: var(--gold); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 64px; }

/* --- header: lockup on the navy band, closed by the reel's two rings ------ */

.marquee {
  position: relative;
  padding: 44px 16px 36px;
  text-align: center;
  margin-bottom: 48px;
  border-bottom: 2px solid var(--gold);
}
/* the mark's outer ring of dots, as a row */
.marquee::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 6px;
  background: radial-gradient(circle, var(--gold) 0 2.6px, transparent 3px) 0 0 / 12.4px 6px repeat-x;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: clamp(12px, 3vw, 32px);
  max-width: 100%;
}
.lockup-mark { width: clamp(72px, 20vw, 190px); height: auto; flex: none; }
.lockup-words { display: inline-grid; margin: 0; font-weight: 400; }
/* "THE SIX DEGREES OF" between two thin double rules */
.lockup-kicker {
  padding: 0.35em 0 0.3em 0.22em; /* left pad offsets the trailing letter-spacing */
  border-top: 3px double var(--gold);
  border-bottom: 3px double var(--gold);
  font: 400 clamp(11px, 2.9vw, 30px)/1.2 var(--deco);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}
.lockup-name {
  margin-right: -0.05em; /* trailing letter-spacing */
  padding-top: 0.06em;
  font: 400 clamp(64px, 17vw, 150px)/0.9 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cream);
}
.tagline {
  max-width: 34em;
  margin: 24px auto 0;
  color: var(--slate);
  font-size: 18px;
}

/* --- search: a marquee board framed in the lockup's double rule ----------- */

.search {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px;
  background: var(--booth);
  border: 3px double var(--gold);
  border-radius: var(--radius);
}
.pair {
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  align-items: end;
}
.person-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--slate);
}

/* a short length of film between the two names */
.splice {
  position: relative;
  height: var(--strip);
  margin-bottom: 21px; /* centre on the 56px inputs */
  background: var(--film);
}
.splice::after {
  content: "";
  position: absolute;
  inset: 3.5px 0;
  background: repeating-linear-gradient(to right, var(--navy) 0 5px, transparent 5px 9px);
}

.combo { position: relative; }
.combo input[type="text"] {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  font: 400 19px var(--text);
  color: var(--cream);
  background: var(--navy);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  outline: none;
}
.combo input[type="text"]::placeholder { color: var(--placeholder); }
.combo input[type="text"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.combo.chosen input[type="text"] { border-color: var(--gold); }

.suggestions {
  position: absolute;
  z-index: 10;
  inset: calc(100% + 6px) 0 auto 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--booth-2);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  max-height: 360px;
  overflow-y: auto;
}
.suggestions li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
}
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--gold-wash); }
.suggestions img, .suggestions .no-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 2px solid var(--gold);
}
.suggestions strong { display: block; font-weight: 500; }
.suggestions small { color: var(--slate); font-size: 14px; }
.suggestions .empty { color: var(--slate); cursor: default; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 28px 0; }
.toggle { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle strong { display: block; font-weight: 500; }
.toggle small { display: block; color: var(--slate); font-size: 15px; line-height: 1.45; }
.switch {
  flex: none;
  position: relative;
  width: 44px;
  height: 24px;
  margin-top: 2px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: var(--navy);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--slate);
  transition: transform 0.15s ease-out;
}
.toggle input:checked + .switch { background: var(--gold); }
.toggle input:checked + .switch::after { transform: translateX(20px); background: var(--navy); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 3px; }

.go {
  width: 100%;
  height: 56px;
  font: 500 19px var(--text);
  letter-spacing: 0.02em;
  color: var(--navy);
  background: var(--gold);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.go:hover { background: var(--gold-hover); }
.form-error { margin: -12px 0 16px; color: var(--cream); }
.form-error::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--red); vertical-align: 2px; }

/* --- notices ---------------------------------------------------------------- */

.notice {
  max-width: 920px;
  margin: 32px auto 0;
  padding: 16px 20px;
  border-left: 3px solid var(--gold);
  background: var(--booth);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice.error { border-left-color: var(--red); }
.result-col .notice { margin: 0; }

/* --- results ---------------------------------------------------------------- */

.verdict {
  margin: 64px 0 40px;
  font: 400 clamp(40px, 6vw, 64px)/1 var(--display);
  letter-spacing: 0.02em;
  color: var(--cream);
}
.verdict small {
  display: block;
  margin-top: 10px;
  font: 400 18px/1.4 var(--text);
  letter-spacing: 0;
  color: var(--slate);
}

.results { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.result-col h3 {
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 3px double var(--gold);
  font: 400 24px/1.2 var(--deco);
  color: var(--gold);
}

/* The path: the mark's red film strip, threading gold-ringed people. */
.strip {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}
.strip::before,
.strip::after {
  content: "";
  position: absolute;
  top: calc(var(--node) / 2);
  bottom: calc(var(--node) / 2);
  animation: thread 1.1s cubic-bezier(0.5, 0, 0.2, 1) both;
}
.strip::before {
  left: calc((var(--node) - var(--strip)) / 2);
  width: var(--strip);
  background: var(--film);
}
.strip::after {
  left: calc((var(--node) - 8px) / 2);
  width: 8px;
  background: repeating-linear-gradient(to bottom, var(--navy) 0 5px, transparent 5px 9px);
}
.results .result-col:nth-child(2) .strip::before,
.results .result-col:nth-child(2) .strip::after { animation-delay: 0.25s; }
@keyframes thread {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

.node,
.frame {
  position: relative;
  z-index: 1; /* above the strip and its sprocket holes */
}
.node {
  display: flex;
  align-items: center;
  gap: 16px;
}
.node-ring {
  flex: none;
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  border: 3.5px solid var(--gold);
  background: var(--navy);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.node-ring img { width: 100%; height: 100%; object-fit: cover; }
.no-photo {
  display: grid;
  place-items: center;
  font: 400 24px var(--display);
  color: var(--gold);
  background: var(--navy);
}
.node-name {
  display: block;
  font: 400 30px/1 var(--display);
  letter-spacing: 0.03em;
  text-decoration: none;
}
.node-role { display: block; margin-top: 2px; color: var(--slate); font-size: 14px; }

.frame {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 14px 0 14px calc(var(--node) + 16px);
  padding: 14px 16px;
  background: var(--booth);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.frame img { width: 52px; border-radius: 3px; flex: none; }
.frame-title { display: block; font-weight: 500; font-size: 18px; line-height: 1.3; }
.frame-meta { display: block; color: var(--slate); font-size: 14px; }
.frame-episode { display: block; color: var(--gold); font-size: 14px; }
.frame dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 15px; }
.frame dt { color: var(--slate); }
.frame dd { margin: 0; }

.meta { margin-top: 48px; color: var(--slate); font-size: 15px; }

/* --- loading: the mark turns like a reel --------------------------------- */

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  background: var(--scrim);
}
.loading[hidden] { display: none; }
.loading img { width: 140px; height: 140px; margin-bottom: 20px; animation: reel 2.4s linear infinite; }
.loading p { margin: 0; font: 400 36px/1.1 var(--display); letter-spacing: 0.03em; }
.loading .elapsed { font: 500 16px var(--text); color: var(--gold); letter-spacing: 0; }
.loading small { max-width: 26em; color: var(--slate); font-size: 15px; }
@keyframes reel { to { transform: rotate(360deg); } }

footer {
  margin-top: 32px;
  padding: 24px 16px 32px;
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--slate);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .loading img, .strip::before, .strip::after { animation: none; }
  .switch::after { transition: none; }
}

@media (max-width: 760px) {
  .marquee { padding-top: 32px; margin-bottom: 40px; }
  .search { padding: 18px; }
  .pair { grid-template-columns: 1fr; }
  .splice { width: var(--strip); height: 28px; margin: 10px auto; }
  .splice::after { inset: 0 3.5px; background: repeating-linear-gradient(to bottom, var(--navy) 0 5px, transparent 5px 9px); }
  .toggles, .results { grid-template-columns: 1fr; }
  .verdict { margin-top: 48px; }
  .node-name { font-size: 26px; }
  .frame { padding: 12px; }
  .frame img { width: 40px; }
  .frame dl { grid-template-columns: 1fr; gap: 0; }
  .frame dd + dt { margin-top: 6px; }
}

/* --- Halloween: all of October --------------------------------------------
   The same marquee in harvest colours: aubergine night, pumpkin where the
   gold was, bone lettering, and a witch-green strip so it never blurs into
   the orange. Pluto is carved into a jack-o'-lantern and flickers. */

.theme-halloween {
  --navy: #120c1a;
  --booth: #1d1427;
  --booth-2: #281b35;
  --rule: #3d2d4c;
  --gold: #f0862a;
  --gold-soft: rgba(240, 134, 42, 0.38);
  --gold-wash: rgba(240, 134, 42, 0.14);
  --gold-hover: #f6a052;
  --cream: #efe6d2;
  --slate: #a597b3;
  --film: #79c043;
  --placeholder: #74668a;
  --scrim: rgba(18, 12, 26, 0.94);
}
.theme-halloween .lockup-mark { animation: candle 3.2s ease-in-out infinite; }
.theme-halloween .loading img { animation: reel 2.4s linear infinite, candle 3.2s ease-in-out infinite; }
@keyframes candle {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(240, 134, 42, 0.45)); }
  18% { filter: drop-shadow(0 0 22px rgba(240, 134, 42, 0.6)); }
  24% { filter: drop-shadow(0 0 10px rgba(240, 134, 42, 0.32)); }
  52% { filter: drop-shadow(0 0 20px rgba(246, 160, 82, 0.55)); }
  70% { filter: drop-shadow(0 0 12px rgba(240, 134, 42, 0.38)); }
}
@media (prefers-reduced-motion: reduce) {
  .theme-halloween .lockup-mark,
  .theme-halloween .loading img { animation: none; filter: drop-shadow(0 0 14px rgba(240, 134, 42, 0.45)); }
}

/* --- Thanksgiving: all of November ------------------------------------------
   Espresso ground, wheat gold, and a cranberry strip; Pluto is a turkey. */

.theme-thanksgiving {
  --navy: #17110d;
  --booth: #221912;
  --booth-2: #2d2118;
  --rule: #46362a;
  --gold: #e2b65a;
  --gold-soft: rgba(226, 182, 90, 0.36);
  --gold-wash: rgba(226, 182, 90, 0.13);
  --gold-hover: #ecc77a;
  --cream: #f3e7cf;
  --slate: #b0a08c;
  --film: #b8323f;
  --placeholder: #7c6c5c;
  --scrim: rgba(23, 17, 13, 0.94);
}

/* --- Christmas: all of December ---------------------------------------------
   Pine night, gold, snow-white lettering and the red strip back in its
   original role; Pluto is an ornament, and snow drifts down the marquee. */

.theme-christmas {
  --navy: #0b1512;
  --booth: #12201b;
  --booth-2: #182a23;
  --rule: #2a4038;
  --gold: #e9c25a;
  --gold-soft: rgba(233, 194, 90, 0.36);
  --gold-wash: rgba(233, 194, 90, 0.13);
  --gold-hover: #f0d27e;
  --cream: #f3efe6;
  --slate: #9fb2a9;
  --film: #d23a3a;
  --placeholder: #5f7a6f;
  --scrim: rgba(11, 21, 18, 0.94);
}
.theme-christmas .marquee > * { position: relative; z-index: 1; }
.theme-christmas .marquee::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(circle, #f3efe6 0 1.6px, transparent 2px),
    radial-gradient(circle, #f3efe6 0 1.1px, transparent 1.5px),
    radial-gradient(circle, #f3efe6 0 2.2px, transparent 2.6px);
  background-size: 120px 140px, 80px 90px, 190px 230px;
  background-position: 10px 0, 50px 30px, 140px 60px;
  animation: snow 14s linear infinite;
}
@keyframes snow {
  to { background-position: 40px 140px, 30px 120px, 170px 290px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-christmas .marquee::before { animation: none; }
}
