@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Mono";
  src: url("fonts/atkinson-mono.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --sans: "Atkinson Next", system-ui, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, monospace;

  --page: #E7EDF0;
  --ink: #15191D;
  --muted: #56616B;
  --line: #CBD4D9;
  --card: #FFFFFF;

  /* the family's room */
  --wall: #D6E2E8;
  --floor: #BFCDD4;
  --floor-edge: #9FB1BA;
  --tray: #F4F7F8;
  --bar: rgba(255, 255, 255, 0.86);

  /* Fitzgerald key */
  --people: #EFBC22;
  --action: #3FA64F;
  --describe: #3D8BDB;
  --social: #E2649F;
  --people-wash: #FDF0C4;
  --action-wash: #D9F0DC;
  --describe-wash: #DCEBFA;
  --social-wash: #FBDDEB;
  --thing: #EC8A2D;
  --thing-wash: #FCE5CF;
  --misc: #9AA5AE;
  --misc-wash: #EEF1F3;

  --focus: #1F6FD1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0F1114;
    --ink: #ECEFF2;
    --muted: #9AA5AE;
    --line: #2A3138;
    --card: #181C21;

    /* the night room of the Telepon clips */
    --wall: #221F45;
    --floor: #18163A;
    --floor-edge: #3B3770;
    --tray: #141230;
    --bar: rgba(13, 12, 32, 0.72);

    --focus: #7AB2FF;
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.top, main, .foot {
  width: min(1000px, 100% - 32px);
  margin-inline: auto;
}

a { color: inherit; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- header ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 22px 18px;
  font: 500 15px/1 var(--mono);
}
.wordmark { letter-spacing: 0.14em; }
.top-mail { color: var(--muted); text-decoration: none; }
.top-mail:hover { color: var(--ink); text-decoration: underline; }

/* ---------- the stage: message bar, family, board ---------- */

.stage {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: var(--wall);
  isolation: isolate;
}

.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px;
  padding: 8px;
  min-height: 92px;
  border-radius: 20px;
  background: var(--bar);
  backdrop-filter: blur(6px);
}

.sentence {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hint {
  padding-left: 10px;
  color: var(--muted);
  font: 500 15px/1.3 var(--mono);
}
.sentence li:not(.hint) { flex: 0 1 86px; min-width: 0; }
.sentence .tile {
  width: 100%;
  font-size: 14px;
  animation: drop-in 0.22s ease-out;
}
@keyframes drop-in {
  from { transform: translateY(-10px); opacity: 0; }
}

.bar-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 72px;
  border: 0;
  border-radius: 16px;
  font: 700 17px/1 var(--sans);
  cursor: pointer;
}
.bar-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.clear {
  width: 60px;
  background: transparent;
  color: var(--muted);
}
.clear:hover { color: var(--ink); }
.say {
  padding-inline: 20px;
  background: var(--ink);
  color: var(--page);
}
.say:active, .clear:active { transform: scale(0.95); }

.family {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0px, 4vw, 64px);
  height: clamp(210px, 30vw, 300px);
  margin-top: -6px;
}
/* the floor they stand on */
.family::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 13%;
  background: var(--floor);
  border-top: 3px solid var(--floor-edge);
}
.person {
  position: relative;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.person.is-held { z-index: 5; cursor: grabbing; }
.person[data-who="jas"] { height: 86%; }
.person svg {
  display: block;
  height: 100%;
  width: auto;
  overflow: visible;
  transform-origin: 50% 96%;
  animation: breathe 3.4s ease-in-out infinite;
}
.person[data-who="jas"] svg { animation-duration: 2.9s; animation-delay: -1.1s; }
.person[data-who="mama"] svg { animation-duration: 3.8s; animation-delay: -2s; }
@keyframes breathe {
  50% { transform: scale(1.006, 1.014); }
}

.board {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: 18px;
  padding: 16px;
  background: var(--tray);
}
.group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.actions { grid-template-columns: repeat(8, minmax(0, 1fr)); }

/* ---------- AAC tiles ---------- */

.tile {
  --c: var(--people);
  --w: var(--people-wash);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 4px 6px;
  border: 4px solid var(--c);
  border-radius: 14px;
  background: #FFFFFF;
  color: #15191D;
  font: 800 15px/1.1 var(--sans);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.tile[data-k="action"] { --c: var(--action); --w: var(--action-wash); }
.tile[data-k="describe"] { --c: var(--describe); --w: var(--describe-wash); }
.tile[data-k="social"] { --c: var(--social); --w: var(--social-wash); }
.tile[data-k="thing"] { --c: var(--thing); --w: var(--thing-wash); }
.tile[data-k="misc"] { --c: var(--misc); --w: var(--misc-wash); }
.tile:hover, .tile.is-picked { background: var(--w); }
.tile:active { transform: scale(0.93); }
.pic {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}
.pic svg { display: block; width: 100%; height: 100%; }
.word {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- about ---------- */

.intro { margin-top: clamp(48px, 8vw, 88px); }
.intro h1 {
  margin: 0;
  font-size: clamp(40px, 7.4vw, 78px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
}
.intro p {
  max-width: 34ch;
  margin: 18px 0 0;
  font-size: clamp(21px, 2.5vw, 27px);
  line-height: 1.4;
}

.label {
  margin: 0 0 16px;
  color: var(--muted);
  font: 500 14px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- works ---------- */

.works { margin-top: clamp(56px, 8vw, 88px); }
.work-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.work-list li { display: flex; }
.work {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: var(--card);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.work:hover { border-color: var(--ink); transform: translateY(-3px); }
.work-pic {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.pic-telepon { background: linear-gradient(140deg, #1D1A3E, #3D2B72); }
.pic-telepon img { width: 34%; height: auto; filter: drop-shadow(0 10px 24px rgba(255, 92, 60, 0.35)); }
.pic-aac0 { background: #FFFFFF; }
.pic-aac0 svg { width: 78%; height: auto; }
.removed rect { fill: #FFFFFF; stroke: #161616; stroke-width: 4; }
.removed circle, .removed path { fill: none; stroke: #D7D7D7; stroke-width: 5; stroke-linecap: round; }
.removed text { fill: #161616; font: 700 17px var(--sans); text-anchor: middle; }
.pic-book { position: relative; background: #0B1626; }
.pic-book img {
  position: absolute;
  inset: 7% 0;
  width: 100%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5));
}

.work-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 20px;
}
.kind { color: var(--muted); font: 500 13px/1.2 var(--mono); }
.work-name { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.work-text { font-size: 17px; line-height: 1.45; }
.go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
  font: 500 15px/1 var(--mono);
}
.go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.work:hover .go svg { transform: translate(2px, -2px); }

/* ---------- research + contact ---------- */

.more {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 40px;
  margin-top: clamp(56px, 8vw, 88px);
  padding-top: 28px;
  border-top: 2px solid var(--line);
}
.rows { margin: 0; padding: 0; list-style: none; }
.row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  text-decoration: none;
}
.row span:first-child { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.row:hover span:first-child { text-decoration-thickness: 2px; }
.row-meta { color: var(--muted); font: 400 14px/1.3 var(--mono); }

.foot {
  margin-block: 64px 32px;
  color: var(--muted);
  font: 400 14px/1.4 var(--mono);
}

/* ---------- narrow screens ---------- */

@media (max-width: 760px) {
  .board { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; }
  .actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .work-list { grid-template-columns: minmax(0, 1fr); }
  .work { flex-direction: row; }
  .work-pic { flex: none; width: 112px; aspect-ratio: auto; }
  .pic-telepon img { width: 64%; }
  .pic-aac0 svg { width: 92%; }
  .work-body { padding: 14px 16px 16px; }
  .work-name { font-size: 22px; }
  .work-text { font-size: 16px; }
  .more { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .stage { border-radius: 22px; }
  .bar { margin: 10px; min-height: 76px; gap: 4px; }
  .sentence li:not(.hint) { flex-basis: 58px; }
  .sentence .tile { font-size: 13px; }
  .hint { font-size: 13px; padding-left: 6px; }
  .bar-btn { height: 58px; }
  .clear { width: 44px; }
  .say { width: 58px; padding: 0; }
  .say span { display: none; }
  .tile { font-size: 13px; border-width: 3px; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .person svg, .sentence .tile { animation: none; }
  .tile, .work, .go svg { transition: none; }
  .work:hover { transform: none; }
}
