/*
 * It's Kentastic: a workshop pegboard. The landing page hangs each app from a
 * peg on a manila tag; the signed-in app is the quiet bench underneath.
 */

:root {
  --wall: #e3e8e4;
  --hole: #c3ccc6;
  --ink: #18233a;
  --ink-soft: #4a566b;
  --manila: #eed9a5;
  --manila-edge: #d6bd80;
  --cobalt: #2b4bd8;
  --cobalt-ink: #ffffff;
  --paper: #fbfcfb;
  --rule: #cbd3ce;
  --danger: #b3261e;
  --success: #1f7a4d;
  --shadow: 0 1px 0 rgb(24 35 58 / 0.08), 0 10px 24px -14px rgb(24 35 58 / 0.45);

  --font-display: "Big Shoulders", "Arial Narrow", sans-serif;
  --font-body: "Atkinson Hyperlegible Next", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.25rem;
  --step-hero: clamp(3.25rem, 10vw, 7.5rem);

  --gutter: clamp(16px, 4vw, 48px);
  --masthead-height: 104px; /* 84px logo + 10px padding above and below */
  --radius: 6px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #19202d;
    --hole: #2a3445;
    --ink: #e8edf5;
    --ink-soft: #a9b4c6;
    --manila: #d9c38c;
    --manila-edge: #b9a26a;
    --cobalt: #8ea2ff;
    --cobalt-ink: #101830;
    --paper: #212a3a;
    --rule: #344055;
    --danger: #ff8a80;
    --success: #6fd39c;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 12px 28px -14px rgb(0 0 0 / 0.8);
    --bench: #0e131c;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { max-width: 100%; display: block; }

a { color: var(--cobalt); text-underline-offset: 0.18em; }

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

h1, h2, h3 { font-family: var(--font-display); line-height: 1; margin: 0; font-weight: 800; letter-spacing: 0.01em; }

p { margin: 0; }

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

/* The pegboard: brown hardboard punched with a grid of holes. */
.pegboard {
  --board: #c69c6d;
  --board-hole: #7a5634;
  --ink-soft: #3f2f1f;
  background-color: var(--board);
  background-image:
    radial-gradient(circle at center, var(--board-hole) 0 3px, rgb(255 236 205 / 0.35) 3.5px, transparent 4.5px),
    linear-gradient(rgb(255 255 255 / 0.04), rgb(0 0 0 / 0.06));
  background-size: 32px 32px, 100% 100%;
  background-position: 16px 16px, 0 0;
}

@media (prefers-color-scheme: dark) {
  .pegboard {
    --board: #5a3f27;
    --board-hole: #2a1b0f;
    --ink: #f6ead8;
    --ink-soft: #e6d3b8;
    --cobalt: #ffd27a;
  }
}

.pegboard .footer a { color: var(--ink); }

/* ---------- Header ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--gutter);
  width: 100%;
  max-width: calc(1240px + 2 * var(--gutter));
  margin-inline: auto;
}

/* The mascot: a 😎 in a tuxedo, leaning in with a thumbs-up. */
.brand { display: inline-block; line-height: 0; border-radius: 12px; }

.logo { width: 84px; height: 84px; overflow: visible; }

.logo__head, .logo__face {
  transform-box: fill-box;
  transform-origin: 50% 85%;
  transition: transform 160ms ease-out;
}

.logo__body { transform-box: fill-box; transform-origin: 50% 100%; transform: rotate(-3deg); }

/* Swings around his left shoulder (98, 92 in the viewBox). */
.logo__arm {
  transform-box: view-box;
  transform-origin: 98px 92px;
  transform: rotate(-12deg);
  transition: transform 160ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .logo__head, .logo__face, .logo__arm { transition: none; }
}

.masthead__nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 600 var(--step-0) / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

.button--primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.button--primary:hover { background: color-mix(in srgb, var(--cobalt) 85%, var(--ink)); }

.button--quiet { border-color: transparent; padding-inline: 10px; }
.button--danger { border-color: var(--danger); color: var(--danger); }
.button--small { min-height: 36px; padding: 6px 12px; font-size: var(--step--1); }
.button--block { width: 100%; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button-row--spaced { margin-top: 16px; }

form.button_to { display: inline; }

/* ---------- Flash ---------- */

.flash-area { padding: 0 var(--gutter); }

.flash {
  max-width: 760px;
  margin: 8px auto;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid currentColor;
  background: var(--paper);
  font-weight: 600;
}
.flash--notice { color: var(--success); }
.flash--alert { color: var(--danger); }

/* ---------- Landing ---------- */

.hero {
  padding: clamp(8px, 2vw, 24px) var(--gutter) clamp(16px, 3vw, 32px);
  display: grid;
  gap: 32px;
  align-items: center;
}

/* The title is a neon sign mounted on the board: a dark backboard in a thin
   metal frame, with the name in pink tubing and a cyan tube around the edge. */
.hero__intro {
  --neon: #ff3fa4;
  --neon-glass: #fff1f8;
  --tube-glow: 0 0 2px var(--neon-glass), 0 0 6px var(--neon), 0 0 14px var(--neon), 0 0 32px var(--neon), 0 0 64px rgb(255 63 164 / 0.55);

  position: relative;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding: clamp(30px, 4.5vw, 46px) clamp(30px, 4.5vw, 54px) clamp(32px, 4.5vw, 46px);
  background:
    radial-gradient(120% 90% at 30% 20%, rgb(255 63 164 / 0.10), transparent 60%),
    linear-gradient(160deg, #1d1622, #0f0b13);
  border: 5px solid #3a3f4a;
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.06),
    inset 0 0 40px rgb(0 0 0 / 0.6),
    0 18px 30px -16px rgb(0 0 0 / 0.7),
    0 0 60px -10px rgb(255 63 164 / 0.35);
  transform: rotate(-0.8deg);
}

/* A cyan tube bent around the inside edge of the sign. */
.hero__tube {
  --tube: #2fe6ff;
  position: absolute;
  inset: 9px;
  border: 3px solid #e6fdff;
  border-radius: 9px;
  box-shadow:
    0 0 4px var(--tube), 0 0 12px var(--tube), 0 0 26px rgb(47 230 255 / 0.55),
    inset 0 0 4px var(--tube), inset 0 0 14px rgb(47 230 255 / 0.45);
  pointer-events: none;
}

.hero__title {
  font-family: "Tilt Neon", var(--font-display);
  font-size: var(--step-hero);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.01em;
  max-width: 9ch;
  color: var(--neon-glass);
  text-shadow: var(--tube-glow);
}

.hero__lede {
  margin-top: clamp(14px, 2vw, 22px);
  max-width: 34ch;
  font-size: var(--step-1);
  line-height: 1.5;
  color: #e9fbff;
  text-shadow: 0 0 6px rgb(0 214 255 / 0.55), 0 0 18px rgb(0 214 255 / 0.25);
}

/* It flickers on once, like a sign warming up, then stays lit. */
@media (prefers-reduced-motion: no-preference) {
  .hero__title { animation: neon-on 1.6s steps(1, end) 0.2s both; }

  .hero__tube { animation: tube-on 1.4s steps(1, end) 0.9s both; }

  @keyframes tube-on {
    0%   { opacity: 0.1; }
    12%  { opacity: 1; }
    18%  { opacity: 0.2; }
    34%  { opacity: 1; }
    40%  { opacity: 0.35; }
    52%  { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes neon-on {
    0%   { opacity: 0.15; text-shadow: none; }
    10%  { opacity: 1; text-shadow: var(--tube-glow); }
    14%  { opacity: 0.25; text-shadow: none; }
    26%  { opacity: 1; text-shadow: var(--tube-glow); }
    30%  { opacity: 0.5; text-shadow: none; }
    38%  { opacity: 1; text-shadow: var(--tube-glow); }
    100% { opacity: 1; text-shadow: var(--tube-glow); }
  }
}

/* The featured app only hangs beside the sign when there's room for both,
   under a wooden plaque that lines up with the mascot in the header. */
.hero__aside { display: none; }

.plaque {
  position: relative;
  justify-self: center;
  padding: 12px 40px 13px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 18px 50%, #e8c77d 0 2px, #9a7a3a 2.5px 4.5px, transparent 5px),
    radial-gradient(circle at calc(100% - 18px) 50%, #e8c77d 0 2px, #9a7a3a 2.5px 4.5px, transparent 5px),
    repeating-linear-gradient(176deg, rgb(255 255 255 / 0.05) 0 2px, transparent 2px 9px, rgb(0 0 0 / 0.06) 9px 11px, transparent 11px 17px),
    linear-gradient(180deg, #a7713b, #8a5a2b 55%, #74481f);
  box-shadow:
    inset 0 2px 0 rgb(255 225 180 / 0.35),
    inset 0 -3px 0 rgb(0 0 0 / 0.25),
    0 10px 18px -10px rgb(0 0 0 / 0.6);
  color: #3a210c;
  font: 900 1.6rem / 1 var(--font-display);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgb(255 220 170 / 0.45), 0 -1px 0 rgb(0 0 0 / 0.35);
  transform: rotate(-1deg);
}

@media (min-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
    align-items: start;
    max-width: calc(1240px + 2 * var(--gutter));
    margin: 0 auto;
    width: 100%;
  }

  /* Pulled up by the header's height so the plaque sits level with the mascot. */
  .hero__aside {
    display: grid;
    gap: 6px;
    margin-top: calc(-1 * var(--masthead-height));
  }

  .hero .hung--featured { display: block; --tilt: 1.4deg; }
  .hung--featured .hung__description { display: none; }
}

.board {
  padding: 0 var(--gutter) clamp(40px, 6vw, 80px);
}

.board__list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 1240px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: clamp(48px, 6vw, 72px) clamp(24px, 4vw, 56px);
}

/* One hanging app: peg, string, tag, then the thing itself. */
.hung {
  --app: var(--cobalt);
  --tilt: 0deg;
  position: relative;
  padding-top: 64px;
  transform-origin: 50% 0;
  transform: rotate(var(--tilt));
}

.hung:nth-child(3n + 1) { --tilt: -1.2deg; }
.hung:nth-child(3n + 2) { --tilt: 0.8deg; }
.hung:nth-child(3n + 3) { --tilt: -0.4deg; }

/* The peg. */
.hung::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgb(255 255 255 / 0.5) 0 2px, transparent 3px), #18233a;
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.25);
}

/* The string, in the app's color, down to the tag. */
.hung::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  width: 3px;
  height: 64px;
  margin-left: -1.5px;
  background: var(--app);
  border-radius: 2px;
}

.tag {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 0 auto -14px;
  padding: 20px 24px 12px;
  background: var(--manila);
  border-radius: 0 0 8px 8px;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%, 0 14px);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 900;
  line-height: 0.9;
  color: #18233a;
  text-align: center;
}

/* The punched hole the string goes through. */
.tag::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--app);
  box-shadow: 0 0 0 2px var(--manila-edge);
}

.hung__body {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-top: 6px solid var(--app);
}

.hung__shot {
  aspect-ratio: 2 / 1;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: top center;
  background: color-mix(in srgb, var(--app) 18%, var(--paper));
  border-bottom: 1px solid var(--rule);
}

.hung__text { padding: 18px 20px 20px; display: grid; gap: 10px; }

.hung__tagline { font-weight: 700; font-size: var(--step-1); line-height: 1.3; }

.hung__description { color: var(--ink-soft); }

.hung__tags { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.hung__tags li {
  font-size: var(--step--1);
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--app) 18%, transparent);
  color: var(--ink);
}

.hung__link { font-weight: 700; justify-self: start; }

/* The whole card, tag included, is the link. */
.hung__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
}
.hung:has(.hung__link:hover) .hung__body { box-shadow: var(--shadow), 0 0 0 3px var(--app); }
.hung:has(.hung__link:focus-visible) .hung__body { outline: 3px solid var(--cobalt); outline-offset: 4px; }
.hung__link:focus-visible { outline: none; }

/* Hanging things swing a little when you reach for them. */
@media (prefers-reduced-motion: no-preference) {
  .hung:hover, .hung:focus-within { animation: swing 900ms ease-out; }

  @keyframes swing {
    0%   { transform: rotate(var(--tilt)); }
    30%  { transform: rotate(calc(var(--tilt) + 2.4deg)); }
    60%  { transform: rotate(calc(var(--tilt) - 1.2deg)); }
    100% { transform: rotate(var(--tilt)); }
  }
}

.bench {
  background: var(--bench, #18233a);
  color: #e3e8e4;
  padding: clamp(40px, 7vw, 80px) var(--gutter);
}

.bench__inner {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: end;
}

.bench h2 { font-size: var(--step-3); max-width: 16ch; }
.bench p { max-width: 46ch; color: #c3ccd8; margin-top: 12px; }
.bench .button { border-color: #e3e8e4; color: #e3e8e4; }
.bench .button--primary { background: #eed9a5; border-color: #eed9a5; color: #18233a; }
.bench .button-row { justify-content: flex-end; }

.footer {
  padding: 24px var(--gutter);
  color: var(--ink-soft);
  font-size: var(--step--1);
}

/* ---------- Forms & auth ---------- */

.sheet {
  width: min(100% - 2 * var(--gutter), 440px);
  margin: clamp(16px, 5vw, 56px) auto;
  padding: clamp(24px, 4vw, 36px);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sheet--wide { width: min(100% - 2 * var(--gutter), 620px); }

.sheet__title { font-size: var(--step-3); margin-bottom: 8px; }
.sheet__lede { color: var(--ink-soft); margin-bottom: 20px; }
.sheet__after { margin-top: 20px; color: var(--ink-soft); text-align: center; }

.stack { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field__label { font-weight: 700; }
.field__hint { color: var(--ink-soft); font-size: var(--step--1); }

.input, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--cobalt); }
.textarea { min-height: 220px; resize: vertical; line-height: 1.6; }

.errors {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--danger);
  color: var(--danger);
}
.errors ul { margin: 6px 0 0; padding-left: 20px; }

.fieldset { border: 0; border-top: 1px solid var(--rule); margin: 8px 0 0; padding: 16px 0 0; display: grid; gap: 16px; min-width: 0; }
.fieldset legend { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); padding-right: 8px; }

/* ---------- Signed-in app ---------- */

.app-nav {
  display: flex;
  gap: 4px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}

.app-nav a {
  padding: 10px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.app-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--cobalt); }

.switcher { position: relative; }
.switcher summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 700;
}
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.switcher summary:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

.switcher__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  min-width: 240px;
  padding: 6px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px var(--rule);
  display: grid;
}
.switcher__menu a, .switcher__menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.switcher__menu a:hover, .switcher__menu button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.switcher__menu a[aria-current="true"] { font-weight: 700; }
.switcher__menu hr { border: 0; border-top: 1px solid var(--rule); margin: 6px 0; width: 100%; }
.switcher__label { padding: 8px 12px 4px; color: var(--ink-soft); font-size: var(--step--1); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--manila);
  color: #18233a;
  font: 900 var(--step--1) / 1 var(--font-display);
  font-size: 1rem;
}

.page {
  width: min(100% - 2 * var(--gutter), 760px);
  margin: clamp(20px, 4vw, 40px) auto 64px;
}

.page__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page__title { font-size: var(--step-3); overflow-wrap: anywhere; }
.page__meta { color: var(--ink-soft); margin-top: 8px; }

.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel--padded { padding: clamp(20px, 4vw, 28px); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rows > li:first-child { border-top: 0; }

.row__main { display: grid; gap: 2px; min-width: 0; }
.row__title { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.row__title:hover { color: var(--cobalt); }
.row__meta { color: var(--ink-soft); font-size: var(--step--1); }

.badge {
  font-size: var(--step--1);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--manila);
  color: #18233a;
}

.empty {
  padding: 40px 24px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}
.empty p { color: var(--ink-soft); max-width: 40ch; }

.note-body { padding: 24px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.note-body--empty { color: var(--ink-soft); }

.section-title { font-size: var(--step-2); margin: 36px 0 12px; }

.comment { padding: 14px 20px; border-top: 1px solid var(--rule); display: grid; gap: 4px; }
.comment:first-child { border-top: 0; }
.comment__head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.comment__body { white-space: pre-wrap; overflow-wrap: anywhere; }

.comment-form { padding: 16px 20px; border-top: 1px solid var(--rule); display: grid; gap: 10px; justify-items: start; }
.comment-form:first-child { border-top: 0; }
.comment-form .textarea { min-height: 96px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 20px; border-top: 1px solid var(--rule); display: grid; gap: 2px; }
.timeline li:first-child { border-top: 0; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 20px; border-top: 1px solid var(--rule); }
.inline-form .input { flex: 1 1 220px; }

@media (max-width: 560px) {
  .masthead { flex-wrap: wrap; }
  .tag { font-size: var(--step-2); }
  .bench .button-row { justify-content: flex-start; }
}
