/* The page around a demo app: same paper, ink and Charter as zhaoqingtan.de. The app inside keeps its own look. */
@font-face { font-family: "Charter"; src: url("fonts/charter/charter_regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Charter"; src: url("fonts/charter/charter_italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Charter"; src: url("fonts/charter/charter_bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #fbf9f4;
  --fg: #26241f;
  --mute: #8a857a;
  --rule: #e8e3d8;
  --link: #a9a294;
  --bezel: #1f1e1b;
  --card: #fffefb;
  --dot: rgba(38, 36, 31, 0.13);
  --shadow: 0 1px 2px rgba(38, 36, 31, 0.04), 0 12px 32px -18px rgba(38, 36, 31, 0.28);
  --serif: "Charter", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", "PingFang SC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513;
    --fg: #e4e0d6;
    --mute: #8f897d;
    --rule: #2d2a25;
    --link: #6f695e;
    --bezel: #000;
    --card: #1d1c19;
    --dot: rgba(228, 224, 214, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513;
  --fg: #e4e0d6;
  --mute: #8f897d;
  --rule: #2d2a25;
  --link: #6f695e;
  --bezel: #000;
  --card: #1d1c19;
  --dot: rgba(228, 224, 214, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* big screens: the whole board grows instead of floating in empty space */
:root { --z: 1; }
@media (min-width: 1560px) and (min-height: 940px) { :root { --z: 1.12; } }
@media (min-width: 1900px) and (min-height: 1150px) { :root { --z: 1.25; } }
@media (min-width: 2400px) and (min-height: 1350px) { :root { --z: 1.45; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) radial-gradient(var(--dot) 1px, transparent 1.3px) 0 0 / 22px 22px;
  color: var(--fg);
  font: 400 18px/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }

.ui { font: 400 13px/1.4 var(--sans); letter-spacing: 0.02em; color: var(--mute); }
.ui a { text-decoration: none; }
.ui a:hover { color: var(--fg); }

/* —— the board: a dotted canvas, the phone in the middle, tour on the left, notes on the right —— */
.frame {
  --gap: clamp(40px, 4.5vw, 80px);
  zoom: var(--z);
  min-height: calc(100vh / var(--z));
  padding: 20px 28px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "top top top" ". title ." "left center right";
  column-gap: var(--gap);
}
.top { grid-area: top; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.top .right, .mobile-bar .right { display: flex; align-items: center; gap: 16px; }
.panel { display: contents; }
.center { display: contents; }
.title { grid-area: title; text-align: center; margin: 4px 0 20px; }
.title h1 { font-size: 28px; line-height: 1.2; font-weight: 400; margin: 0; letter-spacing: -0.01em; }
.title p { margin: 2px 0 0; }

.side { position: relative; align-self: start; margin-top: clamp(28px, 11vh, 120px); width: 100%; max-width: 260px; }
.side.left { grid-area: left; justify-self: end; }
.side.right { grid-area: right; justify-self: start; }
/* leader lines from each side to the phone, like notes on a design board */
.side::after {
  content: ""; position: absolute; top: 24px; width: var(--gap); height: 7px; margin-top: -3px;
  background: radial-gradient(circle, var(--mute) 2.5px, transparent 3px) no-repeat, linear-gradient(var(--rule), var(--rule)) no-repeat;
  background-size: 7px 7px, calc(100% - 4px) 1px;
  pointer-events: none;
}
.side.left::after { left: 100%; background-position: right center, left center; }
.side.right::after { right: 100%; background-position: left center, right center; }
.label { font: 500 11px/1.4 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; }

/* tour steps */
.tour { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; counter-reset: step; }
.step {
  counter-increment: step;
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  text-align: left; font: 400 15px/1.3 var(--sans); color: var(--fg);
  background: none; border: 0; border-radius: 10px;
  padding: 9px 12px 9px 8px; cursor: pointer;
  transition: background 0.15s;
}
.step::before {
  content: counter(step);
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font: 500 12px/1 var(--sans); color: var(--mute);
  border: 1px solid var(--rule);
  transition: all 0.15s;
}
.step::after { content: "→"; margin-left: auto; color: var(--mute); opacity: 0; transform: translateX(-4px); transition: all 0.15s; }
.step:hover, .step[aria-current="step"] { background: rgba(127, 120, 105, 0.09); }
.step:hover::after { opacity: 1; transform: none; }
.step[aria-current="step"]::before { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.step:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.hint { margin: 12px 0 0 8px; }

/* both sides sit on cards; the notes card can be put away */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 16px 14px; box-shadow: var(--shadow); }
.side.left.card { padding: 16px 8px 14px; }
.side.left.card .label { padding: 0 8px; }
.close { font: 400 18px/1 var(--sans); color: var(--mute); background: none; border: 0; padding: 2px 4px; margin: -4px -6px -4px 0; cursor: pointer; }
.close:hover { color: var(--fg); }
.flow { list-style: none; margin: 0 0 14px; padding: 0; }
.flow li { position: relative; padding: 0 0 12px 20px; font: 400 14px/1.3 var(--sans); }
.flow li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--mute); background: var(--bg); z-index: 1; }
.flow li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 12px; bottom: -3px; border-left: 1px solid var(--rule); }
.flow li:last-child { padding-bottom: 0; }
.flow small { display: block; color: var(--mute); font-size: 12px; margin-top: 1px; }
.stack { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 12px 0 0; list-style: none; border-top: 1px solid var(--rule); }
.stack li { font: 400 11.5px/1 var(--sans); color: var(--mute); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 8px; }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; }
.card-foot a { white-space: nowrap; }
.reopen { display: none; margin-top: 7px; font: 400 13px/1.4 var(--sans); letter-spacing: 0.02em; color: var(--mute); background: var(--card); border: 1px solid var(--rule); border-radius: 999px; padding: 8px 14px; cursor: pointer; box-shadow: var(--shadow); }
.reopen:hover { color: var(--fg); }
.card-hidden .side.right .card { display: none; }
.card-hidden .reopen { display: inline-block; }

.lang { display: inline-flex; gap: 2px; }
.lang button { font: inherit; letter-spacing: inherit; color: var(--mute); background: none; border: 1px solid transparent; border-radius: 4px; padding: 3px 7px; cursor: pointer; }
.lang button[aria-pressed="true"] { color: var(--fg); border-color: var(--rule); }
.reset, .about { font: inherit; letter-spacing: inherit; color: var(--mute); background: none; border: 0; padding: 0; cursor: pointer; }
.reset:hover, .about:hover, .lang button:hover { color: var(--fg); }

.phone {
  width: 390px;
  height: clamp(560px, calc(100vh / var(--z) - 160px), 860px);
  grid-area: center;
  justify-self: center;
  position: relative;
  border-radius: 52px;
  padding: 11px;
  background: var(--bezel);
  box-shadow: 0 40px 80px -30px rgba(38, 36, 31, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.phone::before {
  content: ""; position: absolute; inset: -90px -160px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--bg) 55%, transparent);
}
.phone iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 42px; background: #fff; }

.mobile-bar { display: none; }

/* —— phones: the app fills the screen; the tour opens over it —— */
@media (max-width: 899px) {
  html, body { height: 100%; overflow: hidden; }
  body { background: var(--bg); }
  .frame { display: flex; flex-direction: column; padding: 0; height: 100dvh; min-height: 0; }
  .top, .title { display: none; }
  .center { display: flex; flex: 1; min-height: 0; }
  .phone::before, .side::after { display: none; }
  .phone { width: 100%; height: 100%; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .phone iframe { border-radius: 0; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: 44px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--rule); flex: none;
  }
  .about { color: var(--fg); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 11px; }
  .panel { display: none; }
  .panel.open { display: block; position: fixed; inset: 44px 0 0; z-index: 5; overflow-y: auto; padding: 20px 16px 40px; background: var(--bg); }
  .side { max-width: none; margin-top: 0; }
  .side.right { margin-top: 28px; }
  .card-hidden .side.right .card { display: block; }
  .close, .reopen { display: none !important; }
}
