:root {
  --ink: #16191f; --muted: #5f6b7a; --line: #e4e7ec; --link: #0972d3;
  --accent: #d2601a; --paper: #fff; --wash: #f5f7fc;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 17px/1.5 "Amazon Ember", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }

/* Top bar: menu button left, name centred, shortcuts right. Sticky so it stays in the page flow. */
.top {
  position: sticky; top: 0; z-index: 30; height: 64px; flex: none; padding: 0 14px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: #0d0f13; color: #fff;
}
.brand { color: #fff; font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; color: #ffb27d; }
.burger {
  justify-self: start; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px;
  background: none; cursor: pointer; display: grid; place-content: center; gap: 6px;
}
.burger span { display: block; width: 22px; height: 1.5px; background: #fff; transition: transform .2s, opacity .2s; }
.menu-open .burger span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.top .icons { justify-self: end; display: flex; gap: 2px; }
.top .icons a { width: 44px; height: 44px; display: grid; place-content: center; color: #fff; border-radius: 8px; }
.burger:hover, .top .icons a:hover { background: rgba(255, 255, 255, .12); }
.top :focus-visible, .menu :focus-visible, .foot :focus-visible { outline-color: #ffb27d; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Full-screen menu and footer share the same link columns */
body.menu-open { overflow: hidden; }
.menu { position: fixed; inset: 64px 0 0 0; z-index: 25; overflow-y: auto; background: #1b1e25; padding: 56px 24px; }
.menu[hidden] { display: none; }
.links { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 36px 32px; }
.links h2 { margin: 0 0 10px; font-size: 1.05rem; color: #fff; }
.links a { display: block; padding: 4px 0; color: #c8ccd6; overflow-wrap: anywhere; }
.links a:hover { color: #fff; }
.foot { margin-top: auto; background: #1b1e25; padding: 56px 24px 64px; }

/* Home: banner with the search bar overlapping its lower edge, then a grid of cards */
body.home { background: var(--wash); }
.banner {
  text-align: center; color: #fff; padding: 72px 24px 150px;
  background: #16191f url(cubes.svg) center bottom / max(1100px, 100%) auto no-repeat;
}
.banner h1 { margin: 0 0 14px; font-size: clamp(1.9rem, 4.4vw, 2.6rem); font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.banner p { margin: 0 auto; max-width: 720px; font-size: clamp(1.05rem, 2vw, 1.3rem); color: #d9dce6; }
.finder {
  position: relative; z-index: 2; width: calc(100% - 32px); max-width: 860px; margin: -38px auto 0; padding: 7px;
  display: flex; align-items: stretch; background: #fff; border-radius: 999px; box-shadow: 0 10px 30px rgba(22, 25, 31, .16);
  scroll-margin-top: 110px;
}
.finder .seg { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 8px 24px; }
.finder .seg + .seg { border-left: 1px solid var(--line); }
.finder .seg span { font-size: .85rem; font-weight: 700; }
.finder input, .finder select {
  width: 100%; border: 0; outline: 0; padding: 2px 0; background: none; color: var(--ink); font: inherit;
  appearance: none; -webkit-appearance: none;
}
.finder input::placeholder { color: var(--muted); }
.finder .seg:focus-within span { color: var(--accent); }
.finder button {
  flex: none; align-self: center; width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: #0d0f13; color: #fff; cursor: pointer; display: grid; place-content: center;
}
.finder button:hover { background: var(--accent); }

.shelf { width: 100%; max-width: 1088px; margin: 0 auto; padding: 56px 24px 72px; }
.shelf h2 { margin: 0 0 26px; font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 800; letter-spacing: -.01em; }
.shelf h2 span { color: var(--muted); font-weight: 600; }
.shelf h2 a { font-weight: 600; }
.shelf .empty { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 14px;
  box-shadow: 0 1px 4px rgba(22, 25, 31, .08); transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 10px 26px rgba(22, 25, 31, .14); transform: translateY(-2px); }
.card .thumb { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: var(--wash); border-bottom: 1px solid var(--line); }
.card .thumb.blank { display: grid; place-content: center; font-size: 3rem; font-weight: 800; color: #fff; background: var(--accent); }
.card .body { padding: 18px 20px 20px; }
.card .tag { font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.card h3 { margin: 6px 0 6px; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.01em; }
.card h3 a { color: var(--ink); }
.card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card is clickable */
.card:hover h3 a { color: var(--link); text-decoration: none; }
.card p { margin: 0 0 8px; }
.card .meta { margin: 0; color: var(--muted); font-size: .93rem; }
.card .meta a { position: relative; z-index: 1; }
.shelf .grid + h2 { margin-top: 56px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.tiles a {
  display: flex; justify-content: space-between; align-items: baseline; padding: 20px; background: #fff; color: var(--ink);
  border-radius: 14px; box-shadow: 0 1px 4px rgba(22, 25, 31, .08);
}
.tiles a:hover { text-decoration: none; color: var(--link); }
.tiles span { color: var(--muted); }
.shelf .tiles + h2 { margin-top: 56px; }
.publish { padding: 20px; background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(22, 25, 31, .08); }
.publish pre { margin: 0 0 12px; padding: 14px 16px; overflow-x: auto; background: #0d0f13; color: #fff; border-radius: 8px; font: clamp(.7rem, 3vw, .95rem) ui-monospace, SFMono-Regular, Menlo, monospace; }
.publish p { margin: 0; color: var(--muted); }

/* Buttons */
.cta {
  display: inline-block; border: 0; border-radius: 999px; padding: 12px 26px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(210, 96, 26, .28); transition: filter .15s, transform .15s;
}
.cta span { display: inline-block; margin-left: 6px; transition: transform .15s; }
.cta:hover { filter: brightness(1.08); text-decoration: none; }
.cta:hover span { transform: translateX(4px); }
.cta:active { transform: scale(.97); }

/* Centred message pages: notes sign-in, deck not found */
.hero { max-width: 760px; margin: 0 auto; padding: 9vh 24px 9vh; text-align: center; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 18px; }
.hero p { font-size: 1.2rem; color: var(--muted); margin: 0 0 32px; }

/* Deck viewer */
body.deck { height: 100vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; }
.stage { position: relative; min-height: 0; background: var(--wash); }
.slide {
  position: absolute; inset: 20px 84px; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.slide.active { opacity: 1; visibility: visible; }
.slide img {
  max-width: 100%; max-height: 100%; display: block; background: #fff; border-radius: 8px;
  border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(22, 25, 31, .12);
}
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 20px; cursor: pointer;
  display: grid; place-items: center; transition: border-color .15s, color .15s;
}
.nav:hover { border-color: var(--link); color: var(--link); }
.nav.prev { left: 18px; } .nav.next { right: 18px; }
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px 24px; border-top: 1px solid var(--line); background: #fff;
}
.bar .info { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.bar .info b { color: var(--ink); }
.dots { display: flex; gap: 8px; }
.dot {
  width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%;
  background: #cfd5df; cursor: pointer; transition: background .15s, transform .15s;
}
.dot:hover { background: #9aa5b5; }
.dot.active { background: var(--accent); transform: scale(1.25); }
.bar .cta { justify-self: end; padding: 10px 22px; min-width: 132px; }

@media (max-width: 640px) {
  .banner { padding: 48px 20px 120px; }
  .finder { flex-wrap: wrap; border-radius: 22px; }
  .finder .seg { flex: 1 1 100%; padding: 8px 18px; }
  .finder .seg:first-child { border-bottom: 1px solid var(--line); }
  .finder .seg + .seg { flex: 1 1 0; border-left: 0; } /* Kind shares its row with the button */
  .finder button { width: 48px; height: 48px; margin: 6px; }
  .grid { grid-template-columns: 1fr; }
}

/* Deck on phones and touch screens: no controls, just the slide. Tap anywhere to advance. */
.touch-ui { display: none; }
@media (hover: none) and (pointer: coarse), (max-width: 640px) {
  body.deck { display: block; height: 100dvh; background: #000; }
  body.deck .top, body.deck .menu, body.deck .nav, body.deck .bar { display: none; }
  .stage {
    position: fixed; inset: 0; background: #000; cursor: pointer;
    touch-action: manipulation; user-select: none; -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .slide { inset: 0; transition-duration: .2s; }
  .slide img { border: 0; border-radius: 0; box-shadow: none; -webkit-touch-callout: none; pointer-events: none; }
  .touch-ui {
    display: block; position: fixed; left: 0; right: 0; z-index: 3; margin: 0; padding: 0 20px;
    text-align: center; color: rgba(255, 255, 255, .5); pointer-events: none;
    transition: opacity .8s ease;
  }
  .touch-title { top: calc(env(safe-area-inset-top) + 18px); font-size: .95rem; font-weight: 600; }
  .touch-hint {
    bottom: calc(env(safe-area-inset-bottom) + 20px);
    font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  }
  body.started .touch-ui { opacity: 0; }
}
