/* Honey design language, from Ting (docs/DESIGN.md, control-web/src/app.css).
   Keep the tokens in step with Ting. data-theme on <html> forces light or dark;
   without it the device decides. Motion follows the device's reduce-motion setting. */

@font-face {
  font-family: 'Nunito Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('fonts/nunito-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('fonts/nunito-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --canvas: light-dark(#f5eee1, #16120e);
  --surface: light-dark(#fffcf6, #251f18);
  --surface-2: light-dark(#f2e8d6, #30281f);
  --surface-3: light-dark(#eadcc4, #3b3127);
  --line: light-dark(#e8dac3, #3a3027);
  --fg: light-dark(#3b2a2f, #f6ece0);
  --fg-muted: light-dark(#76615a, #b5a492);
  --accent: light-dark(#e09a2d, #f2a93b);
  --accent-fg: #2a1a08;
  --accent-ink: light-dark(#995a05, #f5b656);
  --accent-soft: light-dark(#fbe7c2, #47331a);
  --focus: light-dark(#b8700e, #f2a93b);
  --agent: light-dark(#5e4ec4, #a79bf0);
  --agent-soft: light-dark(#ece8fb, #2e2a48);
  --ok: light-dark(#357a4e, #7fd09a);
  --ok-soft: light-dark(#e1f1e6, #1d3324);
  --shadow-a: light-dark(rgb(110 70 20 / 0.26), rgb(0 0 0 / 0.55));
  --shadow-b: light-dark(rgb(110 70 20 / 0.1), rgb(0 0 0 / 0.35));
  --shadow: 0 10px 30px -14px var(--shadow-a), 0 2px 6px -2px var(--shadow-b);
  --shadow-float: 0 18px 40px -12px var(--shadow-a), 0 4px 10px -4px var(--shadow-b);

  --r-panel: 20px;
  --r-card: 16px;
  --r-control: 12px;
  --r-small: 8px;
  --r-pill: 999px;
  --gap: 10px;

  --dur-1: 140ms;
  --dur-2: 240ms;
  --dur-3: 380ms;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --move: 1;

  --font: 'Nunito Variable', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wrap: 1120px;
  color-scheme: light dark;
  font: 16px/1.55 var(--font);
  color: var(--fg);
  background: var(--canvas);
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-2: 140ms;
    --dur-3: 140ms;
    --ease-spring: ease-out;
    --move: 0;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--canvas); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-ink); font-weight: 600; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: var(--r-small); }
.muted { color: var(--fg-muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: 12px; top: -60px; background: var(--accent); color: var(--accent-fg); padding: 0.5rem 1rem; border-radius: var(--r-pill); z-index: 10; }
.skip:focus { top: 12px; }

/* ---------- buttons ---------- */
.button, button {
  font: inherit;
  color: var(--fg);
  cursor: pointer;
  border: 0;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 0.6rem 1.15rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    background var(--dur-1) ease,
    color var(--dur-1) ease,
    border-radius var(--dur-3) var(--ease-spring),
    transform var(--dur-3) var(--ease-spring);
}
.button:hover, button:hover { background: var(--surface-3); }
.button:active, button:active { transform: scale(calc(1 - 0.04 * var(--move))); border-radius: 14px; }
.button.primary { background: var(--accent); color: var(--accent-fg); }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.ext { width: 1em; height: 1em; }
button.icon { background: none; padding: 0.45rem; border-radius: var(--r-control); color: var(--fg-muted); }
button.icon:hover { background: var(--surface-2); color: var(--fg); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: var(--gap);
  z-index: 5;
  width: min(var(--wrap), 100% - 20px);
  margin: var(--gap) auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.6rem 0.5rem 1rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand b { font-weight: 800; color: var(--accent-ink); }
.topbar nav { display: flex; align-items: center; gap: 0.15rem; }
.topbar nav a { color: var(--fg); text-decoration: none; font-weight: 700; padding: 0.4rem 0.8rem; border-radius: var(--r-pill); transition: background var(--dur-1) ease; }
.topbar nav a:hover { background: var(--surface-2); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .sun { display: none; }
  :root:not([data-theme='light']) .theme-toggle .moon { display: inline; }
}
:root[data-theme='dark'] .theme-toggle .sun { display: none; }
:root[data-theme='dark'] .theme-toggle .moon { display: inline; }

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(1.5rem, 4vw, 3rem); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.25fr 1fr; gap: 2.5rem; align-items: center; }
.eyebrow { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); margin-bottom: 0.9rem; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: -0.025em; }
.lede { font-size: clamp(1.08rem, 1.6vw, 1.25rem); color: var(--fg-muted); margin-top: 1rem; max-width: 40rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }
.hero-icons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 132px)); gap: 1.1rem; justify-content: center; }
.hero-icons li { animation: rise var(--dur-3) var(--ease-spring) both; animation-delay: calc(var(--i) * 70ms); }
.hero-icons li:nth-child(even) { transform: translateY(1.6rem); }
.hero-icons a { display: block; padding: 18px; background: var(--surface); border-radius: 30px; box-shadow: var(--shadow-float); transition: transform var(--dur-3) var(--ease-spring); }
.hero-icons a:hover { transform: rotate(calc(-4deg * var(--move))) scale(calc(1 + 0.05 * var(--move))); }
.hero-icons img { display: block; border-radius: 22%; }
@keyframes rise { from { opacity: 0; translate: 0 calc(16px * var(--move)); } }

/* ---------- sections ---------- */
.section-label { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--fg-muted); margin: 0 0 0.9rem 0.25rem; }
.featured { margin-top: 1rem; }
.feature-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.feature-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.3rem;
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow);
  color: var(--fg);
  text-decoration: none;
  transition: transform var(--dur-3) var(--ease-spring), box-shadow var(--dur-2) ease;
}
.feature-card:hover { transform: translateY(calc(-4px * var(--move))); box-shadow: var(--shadow-float); }
.feature-card .app-icon { margin-bottom: 0.5rem; }
.feature-name { font-size: 1.25rem; font-weight: 800; }
.feature-tagline { color: var(--fg-muted); font-weight: 500; flex: 1; }
.more { color: var(--accent-ink); font-weight: 700; margin-top: 0.4rem; }
.more span { display: inline-block; transition: transform var(--dur-2) var(--ease-spring); }
.feature-card:hover .more span { transform: translateX(calc(4px * var(--move))); }

.app-icon { border-radius: 22%; flex: none; align-self: flex-start; aspect-ratio: 1; object-fit: contain; box-shadow: 0 4px 12px -6px var(--shadow-a); background: var(--surface); }

.catalogue { margin-top: clamp(3rem, 7vw, 5rem); scroll-margin-top: 90px; }
.catalogue-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.catalogue-head h2, .about h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.filter { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); }
.seg { padding: 0.35rem 0.8rem; font-size: 0.88rem; background: transparent; }
.seg:hover { background: var(--surface-3); }
.seg[aria-pressed='true'] { background: var(--surface); box-shadow: var(--shadow); color: var(--accent-ink); }
.empty { padding: 2rem 0; text-align: center; }

.category { margin-top: 2rem; }
.category[hidden] { display: none; }
.category-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.9rem; margin: 0 0 0.9rem 0.25rem; }
.category-head h3 { font-size: 1.15rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card[hidden] { display: none; }
.card-link {
  height: 100%;
  display: flex;
  gap: 1rem;
  padding: 1.1rem;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  color: var(--fg);
  text-decoration: none;
  font-weight: 400;
  transition: transform var(--dur-3) var(--ease-spring), box-shadow var(--dur-2) ease;
}
.card-link .app-icon { width: 64px; height: 64px; }
.feature-card .app-icon { width: 56px; height: 56px; }
.card-link:hover { transform: translateY(calc(-3px * var(--move))); box-shadow: var(--shadow-float); }
.card-body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.card-name { font-size: 1.12rem; font-weight: 800; }
.card-tagline { font-weight: 700; }
.card-summary { font-size: 0.93rem; }
.card-platforms { font-size: 0.8rem; font-weight: 600; margin-top: auto; padding-top: 0.35rem; }

.pill { display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 0.15rem 0.6rem; border-radius: var(--r-pill); white-space: nowrap; letter-spacing: 0.01em; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill-agent { background: var(--agent-soft); color: var(--agent); }
.pill-muted { background: var(--surface-2); color: var(--fg-muted); }

.about { margin-top: clamp(3rem, 7vw, 5rem); scroll-margin-top: 90px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 1.2rem; }
.panel { background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 1.5rem; }
.panel h3 { font-size: 1.1rem; margin: 0.6rem 0 0.4rem; }
.badge-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 30%; background: var(--accent-soft); color: var(--accent-ink); font-size: 1.1rem; }

/* ---------- app page ---------- */
.crumbs { margin-top: 2rem; font-size: 0.9rem; color: var(--fg-muted); display: flex; gap: 0.5rem; }
.app-hero { display: flex; gap: 2rem; align-items: center; padding: 1.5rem 0 2rem; }
.app-icon.big { width: 128px; height: 128px; box-shadow: var(--shadow-float); animation: pop var(--dur-3) var(--ease-spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(calc(1 - 0.12 * var(--move))); } }
.app-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.app-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -0.02em; }
.app-hero .lede { margin-top: 0.4rem; }
.chips { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--surface-2); border-radius: var(--r-pill); padding: 0.2rem 0.75rem; font-size: 0.85rem; font-weight: 700; }
.soon { color: var(--fg-muted); font-weight: 600; background: var(--surface); border-radius: var(--r-pill); padding: 0.55rem 1.1rem; box-shadow: var(--shadow); }
.shot { margin-block: 0 1.5rem; }
.shot img { display: block; width: 100%; border-radius: var(--r-panel); box-shadow: var(--shadow-float); }
.app-about { margin-bottom: 2rem; }
.prose { max-width: 50rem; }
.prose h2 { font-size: 1.35rem; margin-bottom: 0.8rem; }
.prose p + p { margin-top: 0.9rem; }
.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.feature { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 1.2rem 1.25rem; border-top: 4px solid var(--accent); }
.feature h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.feature p { font-size: 0.94rem; }
.more-apps { margin-top: 3rem; }
.notfound { margin-top: 4rem; text-align: center; }
.notfound .panel { max-width: 30rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }

/* ---------- footer ---------- */
.footer { margin-top: 5rem; padding: 2rem 0 2.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 2rem; font-size: 0.9rem; }
.footer-inner p { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-icons { grid-template-columns: repeat(4, minmax(0, 84px)); gap: 0.7rem; justify-content: start; }
  .hero-icons a { padding: 10px; border-radius: 22px; }
  .hero-icons li:nth-child(even) { transform: none; }
}
@media (max-width: 600px) {
  .topbar nav a { padding: 0.4rem 0.55rem; }
  .brand span { display: none; }
  .cards { grid-template-columns: 1fr; }
  .app-hero { flex-direction: column; align-items: flex-start; gap: 1.2rem; }
  .app-icon.big { width: 96px; height: 96px; }
  .filter { width: 100%; }
}
