/* ==========================================================================
   AI Services Showcase — design system
   Minimal, tactile surfaces: soft emboss for ordinary elements, a thin
   liquid-metal edge reserved for the important actions. Follows the system
   colour scheme.
   ========================================================================== */

@property --a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --b {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@view-transition {
  navigation: auto;
}

/* ---------- tokens ------------------------------------------------------ */
:root {
  color-scheme: light dark;

  /* Latin: Helvetica Neue (UltraLight = 100). Japanese falls through to
     M PLUS 1p because Helvetica Neue carries no kana/kanji. */
  --font: "Helvetica Neue", "HelveticaNeue", "M PLUS 1p", "Hiragino Sans",
    "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --bg: #e9e9eb;
  --surface-hi: #f7f7f8;
  --surface-lo: #e5e5e8;
  --well: #dddde0;
  --ink: #17171a;
  --ink-2: #56565e;
  --ink-3: #8c8c95;
  --line: rgba(0, 0, 0, 0.07);

  --hi: rgba(255, 255, 255, 0.95); /* lit edge */
  --lo-in: rgba(0, 0, 0, 0.05); /* shaded inner edge */
  --drop-near: rgba(30, 30, 50, 0.1);
  --drop-far: rgba(30, 30, 50, 0.3);
  --sink-shade: rgba(0, 0, 0, 0.17);
  --sink-lip: rgba(255, 255, 255, 0.9);

  /* engraved text / glyphs: a hairline of light under the stroke */
  --deboss: 0 1px 0 rgba(255, 255, 255, 0.85);
  --deboss-glyph: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.85));

  --ok: #2fae6b;
  --warn: #d6962a;
  --bad: #d8514a;

  --raise: inset 0 1px 0 var(--hi), inset 0 -1px 0 var(--lo-in),
    0 1px 2px var(--drop-near), 0 12px 26px -14px var(--drop-far);
  --raise-sm: inset 0 1px 0 var(--hi), inset 0 -1px 0 var(--lo-in),
    0 1px 2px var(--drop-near), 0 5px 10px -6px var(--drop-far);
  --sink: inset 0 1px 3px var(--sink-shade), inset 0 0 0 1px var(--line),
    0 1px 0 var(--sink-lip);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.45, 0.5, 1);

  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface-hi: #242427;
    --surface-lo: #1a1a1d;
    --well: #0e0e10;
    --ink: #f1f1f4;
    --ink-2: #a6a6af;
    --ink-3: #777781;
    --line: rgba(255, 255, 255, 0.06);

    --hi: rgba(255, 255, 255, 0.09);
    --lo-in: rgba(0, 0, 0, 0.45);
    --drop-near: rgba(0, 0, 0, 0.5);
    --drop-far: rgba(0, 0, 0, 0.85);
    --sink-shade: rgba(0, 0, 0, 0.75);
    --sink-lip: rgba(255, 255, 255, 0.05);

    --deboss: 0 -1px 0 rgba(0, 0, 0, 0.75), 0 1px 0 rgba(255, 255, 255, 0.05);
    --deboss-glyph: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.75));

    --ok: #46c986;
    --warn: #e2ab46;
    --bad: #ec6a62;
  }
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 100;
  line-height: 1.5;
  letter-spacing: 0.022em;
  text-shadow: var(--deboss);
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  /* light-on-dark blooms; trim it so the ultra-light stays ultra-light */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* fine grain, like brushed anodised metal */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

h1,
h2,
h3,
p {
  margin: 0;
  font-weight: inherit;
}

a {
  color: inherit;
}

button,
select,
input {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-shadow: inherit;
}

svg.glyph {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: var(--deboss-glyph);
}

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

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

/* ---------- entrance ---------------------------------------------------- */
.reveal {
  animation: rise 0.9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 80ms + 60ms);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
}

/* ---------- top bar + breadcrumbs --------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  min-height: 76px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px var(--gutter);
  view-transition-name: topbar;
}
.crumbs {
  margin-left: -11px; /* optical: align crumb text with the page edge */
}

.crumbs ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.crumbs li {
  display: flex;
  align-items: center;
  animation: crumb-in 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes crumb-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}
/* engraved slash between levels */
.crumbs li + li::before {
  content: "";
  width: 1px;
  height: 15px;
  margin: 0 8px 0 6px;
  background: var(--ink-3);
  box-shadow: 1px 0 0 var(--sink-lip);
  transform: rotate(18deg);
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease), transform 0.2s var(--ease);
}
a.crumb:hover {
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: var(--raise-sm);
}
a.crumb:active {
  transform: translateY(1px);
  box-shadow: var(--sink);
  background: var(--well);
}
.crumb[aria-current="page"] {
  color: var(--ink);
}

/* ---------- status pill ------------------------------------------------- */
.led {
  --led: var(--ink-3);
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--led);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 9px -1px var(--led);
  transition: background-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
[data-tone="ok"] > .led,
.led[data-tone="ok"] {
  --led: var(--ok);
}
[data-tone="warn"] > .led,
.led[data-tone="warn"] {
  --led: var(--warn);
}
[data-tone="bad"] > .led,
.led[data-tone="bad"] {
  --led: var(--bad);
}
[data-tone="busy"] > .led,
.led[data-tone="busy"] {
  --led: var(--warn);
  animation: led-pulse 1.1s ease-in-out infinite;
}
@keyframes led-pulse {
  50% {
    opacity: 0.35;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px 7px 11px;
  border-radius: 999px;
  background: var(--well);
  box-shadow: var(--sink);
  font-size: 12.5px;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill b {
  font-weight: 300;
  color: var(--ink);
}

/* ---------- page -------------------------------------------------------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter) 88px;
}

.title {
  margin-top: clamp(20px, 5vw, 48px);
  font-size: clamp(42px, 7.2vw, 78px);
  font-weight: 100;
  line-height: 1.04;
  letter-spacing: 0.006em;
  text-wrap: balance;
}
.lede {
  margin-top: 14px;
  max-width: 46ch;
  font-size: clamp(16px, 1.6vw, 19px);
  font-weight: 200;
  color: var(--ink-2);
  text-wrap: pretty;
}

.eyebrow {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-3) 60%, var(--ink-2));
}

/* ---------- surfaces ---------------------------------------------------- */
.raised {
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: var(--raise);
}
.sunken {
  background: var(--well);
  box-shadow: var(--sink);
}

/* ---------- ordinary button --------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: var(--raise-sm);
  font-size: 15px;
  font-weight: 200;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease),
    color 0.25s var(--ease);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: var(--sink);
}
.btn.icon {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
}

/* ---------- liquid-metal edge (important actions only) ------------------
   Two conic sweeps counter-rotate inside a ring-shaped mask. Their
   interference reads as flowing chrome; the thin orange/blue slivers are the
   dispersion fringe you get where a highlight meets a shadow.
   Tune with --ring (thickness), --ring-inset and --metal-speed.           */
.metal {
  position: relative;
  isolation: isolate;
}
.metal::before,
.metal::after {
  content: "";
  position: absolute;
  inset: var(--ring-inset, 0px);
  padding: var(--ring, 1.5px);
  border-radius: var(--ring-radius, inherit);
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
}
.metal::before {
  background: conic-gradient(
    from var(--a),
    #fbfbfc 0%,
    #d5d7dc 6%,
    #8b8e97 12%,
    #2b2c31 18%,
    #0b0b0d 22%,
    #3a3b42 26%,
    #ff9d47 28.4%,
    #fff6e8 30%,
    #7cc7ff 31.6%,
    #eceef1 35%,
    #ffffff 45%,
    #c4c6cc 54%,
    #74777f 60%,
    #1a1a1e 67%,
    #050506 71%,
    #45464d 75%,
    #6fd0ff 77.4%,
    #ffffff 79%,
    #ffb066 80.6%,
    #dfe1e5 85%,
    #fbfbfc 100%
  );
  animation: metal-a var(--metal-speed, 14s) linear infinite;
}
.metal::after {
  background: conic-gradient(
    from var(--b),
    transparent 0%,
    rgba(255, 255, 255, 0.92) 9%,
    transparent 21%,
    rgba(0, 0, 0, 0.6) 37%,
    transparent 52%,
    rgba(255, 255, 255, 0.85) 64%,
    transparent 77%,
    rgba(0, 0, 0, 0.45) 90%,
    transparent 100%
  );
  animation: metal-b calc(var(--metal-speed, 14s) * 1.7) linear infinite;
}
@keyframes metal-a {
  to {
    --a: 360deg;
  }
}
@keyframes metal-b {
  to {
    --b: -360deg;
  }
}
/* Speed changes (hover, live state) go through setMetalRate() in shell.js so
   the sweep accelerates smoothly instead of jumping to a new angle. */

/* ---------- field / select ---------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 11px 16px 10px;
  border-radius: 16px;
}
.select {
  position: relative;
  display: flex;
  align-items: center;
}
.select select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  padding: 2px 26px 2px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 21px;
  font-weight: 100;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select svg {
  position: absolute;
  right: 0;
  pointer-events: none;
  color: var(--ink-3);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}
.select:hover svg {
  transform: translateY(2px);
  color: var(--ink);
}

/* ---------- segmented control ------------------------------------------- */
.seg {
  --n: 2;
  --i: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  padding: 3px;
  border-radius: 12px;
}
.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--n));
  border-radius: 9px;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: var(--raise-sm);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 0.45s var(--spring);
}
.seg label {
  position: relative;
  z-index: 1;
  padding: 5px 16px;
  font-size: 16px;
  font-weight: 200;
  text-align: center;
  color: var(--ink-3);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.seg label:hover {
  color: var(--ink-2);
}
.seg label:has(input:checked) {
  color: var(--ink);
}
.seg label:has(input:focus-visible) {
  outline: 1px solid var(--ink-2);
  outline-offset: 1px;
  border-radius: 9px;
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ---------- motion preferences ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  @view-transition {
    navigation: none;
  }
}
