:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --ink: #111111;
  --ink-2: #2e2e2c;
  --muted: #5b5b57;
  --line: #deddd7;
  --soft: #eeede8;
  --chip: #efeee9;
  --dots: #d6d5ce;
  --accent: #2b4bff;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(14px, 3vh, 32px) clamp(20px, 4.4vw, 56px) clamp(12px, 2vh, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.6vh, 28px);
  height: 100vh;
  height: 100dvh;
}

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.handle { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.hello { font-size: 15px; font-weight: 500; border-bottom: 1.5px solid var(--accent); padding-bottom: 2px; }

/* hero */
.hero { display: flex; flex-direction: column; gap: 8px; }
.hero h1 {
  margin: 0;
  font-size: clamp(28px, min(4.6vw, 7vh), 56px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 500;
}
.words { display: inline-grid; }
.words span {
  grid-area: 1 / 1;
  color: var(--accent);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.words span.on { opacity: 1; transform: translateY(0); }
.hero p { margin: 0; max-width: 52ch; font-size: 16px; line-height: 1.6; color: var(--muted); }

/* cards */
.desk-cards { display: flex; flex-wrap: nowrap; gap: 20px; flex: 1 1 auto; min-height: 0; }
.card {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.04);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.card:hover { transform: translateY(-6px) rotate(-0.5deg); }
.card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 14px 36px rgba(43, 75, 255, 0.16);
}
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-preview {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid var(--soft);
  overflow: hidden;
}
.card-preview > * { zoom: var(--pz, 1); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px 16px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-select {
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.card-select::after { content: ""; position: absolute; inset: 0; }
.card-select:focus-visible { outline: none; }
.card-blurb { font-size: 14px; line-height: 1.55; color: var(--muted); margin: 0; }
.pill {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid #c9c8c1;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.card.is-selected .pill { color: var(--accent); border-color: var(--accent); }

/* detail strip */
.detail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 48px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  align-items: flex-start;
}
.detail-left { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.detail-right { flex: 2 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.detail h2 { margin: 0; font-size: 28px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 500; }
.detail p { margin: 0; max-width: 64ch; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--chip); border-radius: 6px; padding: 4px 10px; }
.open {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1.5px solid var(--accent);
  transition: transform 0.2s ease;
}
a.open:hover { transform: translateX(4px); }
.open.soon { color: var(--muted); border-bottom: 1.5px dashed #a9a8a1; }

/* footer */
.foot { font-size: 12px; color: var(--muted); }
.noscript { color: var(--muted); }

/* previews: Afterwords */
.letters { display: flex; flex-direction: column; gap: 4px; }
.lrow { position: relative; display: flex; gap: 4px; }
.cell {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  color: #6b6b66;
  border-radius: 50%;
  border: 1.5px solid transparent;
}
.cell.w { color: var(--ink); border-color: var(--accent); animation: rub 6s ease-in-out infinite; }
.eraser {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 12px;
  border-radius: 5px;
  background: var(--ink);
  left: 0;
  opacity: 0;
  animation: sweep 6s ease-in-out infinite;
}
@keyframes rub { 0%, 22% { opacity: 1; } 34%, 78% { opacity: 0.05; } 92%, 100% { opacity: 1; } }
@keyframes sweep {
  0%, 20% { left: 0; opacity: 0; }
  22% { left: 0; opacity: 1; }
  36% { left: calc(100% - 12px); opacity: 1; }
  38%, 100% { left: calc(100% - 12px); opacity: 0; }
}

/* previews: swipe card */
.swipe-wrap { position: relative; width: 165px; height: 218px; }
.swipe-scale { position: absolute; left: 0; top: 0; width: 220px; height: 290px; transform: scale(0.75); transform-origin: 0 0; }
.swipe-back { position: absolute; left: 12px; top: 10px; width: 200px; height: 266px; border-radius: 16px; background: #f3f2ee; border: 1.5px solid var(--line); transform: rotate(3deg); }
.swipe-card {
  position: absolute; left: 0; top: 0; width: 212px; height: 276px;
  border-radius: 16px; background: #fff; border: 1.5px solid var(--line);
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.08);
  padding: 12px; display: flex; flex-direction: column; gap: 12px;
  animation: swipe 5s ease-in-out infinite;
}
.swipe-poster { flex: 1 1 auto; border-radius: 10px; background: var(--chip); display: flex; align-items: center; justify-content: center; }
.swipe-lines { display: flex; flex-direction: column; gap: 8px; }
.swipe-lines i { display: block; height: 10px; width: 70%; border-radius: 5px; background: var(--ink); }
.swipe-lines i + i { height: 8px; width: 45%; border-radius: 4px; background: var(--line); }
.stamp {
  position: absolute; top: 20px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em;
  border-radius: 6px; padding: 2px 8px; background: #fff; border: 1.5px solid; opacity: 0;
}
.stamp.yes { left: 20px; color: var(--accent); animation: yes 5s ease-in-out infinite; }
.stamp.no { right: 20px; color: var(--ink); animation: no 5s ease-in-out infinite; }
@keyframes swipe {
  0%, 10% { transform: translateX(0) rotate(0deg) scale(1); opacity: 1; }
  28% { transform: translateX(170px) rotate(16deg) scale(1); opacity: 0; }
  29% { transform: translateX(0) rotate(0deg) scale(0.94); opacity: 0; }
  40%, 52% { transform: translateX(0) rotate(0deg) scale(1); opacity: 1; }
  68% { transform: translateX(-170px) rotate(-16deg) scale(1); opacity: 0; }
  69% { transform: translateX(0) rotate(0deg) scale(0.94); opacity: 0; }
  80%, 100% { transform: translateX(0) rotate(0deg) scale(1); opacity: 1; }
}
@keyframes yes { 0%, 10% { opacity: 0; } 18%, 28% { opacity: 1; } 29%, 100% { opacity: 0; } }
@keyframes no { 0%, 50% { opacity: 0; } 58%, 68% { opacity: 1; } 69%, 100% { opacity: 0; } }

/* previews: placeholder */
.ghost {
  width: 100%; max-width: 240px; height: 160px; border: 1.5px dashed #a9a8a1; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.caret { width: 2px; height: 16px; background: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.card-preview img { max-width: 100%; max-height: 100%; border-radius: 10px; object-fit: cover; }

/* small or short screens: let the page scroll instead of squeezing */
@media (max-width: 760px), (max-height: 560px) {
  .page { height: auto; min-height: 100vh; }
  .desk-cards { flex-wrap: wrap; flex: none; }
  .card { flex: 1 1 260px; }
  .card-preview { flex: none; height: 200px; }
  .hero h1 { font-size: clamp(30px, 8vw, 44px); }
}

@media (prefers-reduced-motion: reduce) {
  .cell.w, .eraser, .swipe-card, .stamp, .caret { animation: none; }
  .cell.w { opacity: 1; }
  .card:hover { transform: none; }
  .words span { transition: none; }
}
