/* ==========================================================================
   Noomi · unified entry
   Depends on tokens.css for every colour, radius, shadow and timing value.
   ========================================================================== */

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

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

body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 64px canvas grid, faded out at the edges so text areas stay clean */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--canvas-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--canvas-grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  -webkit-mask-image: radial-gradient(120% 85% at 50% 0%, #000 30%, transparent 82%);
  mask-image: radial-gradient(120% 85% at 50% 0%, #000 30%, transparent 82%);
}

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

[hidden] { display: none !important; }

h1, h2, h3, p, ul { margin: 0; }

.mono { font-family: var(--font-mono); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Focus: one visible ring for every interactive element */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-hover);
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-h);
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-chip);
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: var(--shadow-mark);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
}

.brand-divider {
  width: 2px;
  height: 18px;
  border-radius: 1px;
  background: var(--line);
  flex: none;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  flex: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}

/* expands the 26px pill to a 44px touch target */
.seg-btn::after {
  content: "";
  position: absolute;
  inset: -9px -3px;
}
.seg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.seg-short { display: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-control);
  color: var(--ink-2);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }

.icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

/* Help popover */
.help-panel {
  position: absolute;
  top: calc(100% - 8px);
  right: var(--gutter);
  width: 296px;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-hover);
  z-index: 60;
}
.help-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.help-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.help-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.help-list kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--r-chip);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
}
.help-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: 76px 0 58px;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 48px;
  align-items: end;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 18px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.025em;
  color: var(--ink);
  margin-bottom: 16px;
}
.hero-line { display: block; }

.hero-sub {
  font-size: 16px;
  color: var(--ink-2);
  margin-bottom: 26px;
  max-width: 34em;
}

.hero-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-size: 12px;
  color: var(--ink-2);
}
.status-count b {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}
.status-dots { display: inline-flex; align-items: center; gap: 8px; }
.hero-updated {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.hero-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-bottom: 2px;
}

.command {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 10px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.command:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--ring);
}
.command-icon { color: var(--ink-3); flex: none; }
.command input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.command input::placeholder { color: var(--ink-3); }
.command input:focus,
.command input:focus-visible { outline: none; box-shadow: none; }
.command input::-webkit-search-cancel-button { display: none; }

.kbd {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--r-chip);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
}

.command-hint {
  font-size: 11px;
  color: var(--ink-3);
  padding-left: 2px;
}

/* ==========================================================================
   Services
   ========================================================================== */

.services { padding-top: 8px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow-bar {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px 0 11px;
  margin-bottom: 10px;
  background: var(--navy);
  color: var(--on-navy);
  border-radius: var(--r-chip);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  box-shadow: inset 3px 0 0 var(--data-blue);
}

.section-head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}

.section-note {
  font-size: 12px;
  color: var(--ink-3);
  padding-bottom: 3px;
  white-space: nowrap;
}

.service-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 900px) {
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1080px) {
  .service-grid[data-count="3"],
  .service-grid[data-count="4"],
  .service-grid[data-count="5"],
  .service-grid[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Card */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 24px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--card-accent, var(--accent));
  opacity: .55;
  transition: opacity var(--dur) var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: var(--shadow-hover);
}
.card:hover::before { opacity: 1; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-icon);
  background: var(--accent-soft);
  color: var(--card-accent, var(--accent));
  flex: none;
}
:root[data-theme="dark"] .card-icon {
  color: color-mix(in srgb, var(--card-accent) 58%, var(--ink));
}

.card-icon svg { width: 24px; height: 24px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--live);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 16%, transparent);
}
.dot.is-online { animation: breathe 2.4s var(--ease) infinite; }
.dot.is-warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent);
  animation: none;
}
.dot.is-auth {
  background: var(--ink-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-3) 18%, transparent);
  animation: none;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 22%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 8%, transparent); }
}

.card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.card-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.3;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--r-chip);
  font-size: 12px;
  line-height: 1;
  color: var(--ink-2);
  background: var(--surface-2);
}
.chip-cat {
  height: 22px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: transparent;
}

.card-tagline {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 16px;
  max-width: 32em;
}

.features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.access {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  min-width: 0;
}
.access svg { flex: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
  transition:
    background-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.btn svg {
  transition: transform var(--dur) var(--ease);
}
.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn:hover svg { transform: translateX(2px); }
.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Empty search state */
.empty-state {
  margin-top: 8px;
  padding: 28px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}

/* No-JS fallback */
.noscript-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.noscript-list a {
  display: block;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-decoration: none;
  color: var(--ink-2);
}
.noscript-list a:hover { border-color: var(--accent); color: var(--ink); }

/* ==========================================================================
   Quick actions
   ========================================================================== */

.quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.quick a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
/* keeps the visual height at 40px while the touch target reaches 44px */
.quick a::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
}
.quick a:hover { background: var(--surface-3); color: var(--ink); }
.quick a svg { flex: none; color: var(--ink-3); }
.quick a:hover svg { color: var(--ink-2); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 64px;
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11px;
  color: var(--ink-3);
}
.footer-meta .sep { color: var(--line-strong); }
.footer-last { color: var(--ink-3); }
.footer-last::before {
  content: "·";
  margin-right: 7px;
  color: var(--line-strong);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 11px;
}
.footer-links a,
.footer-links button {
  color: var(--ink-3);
  text-decoration: none;
  font-size: 11px;
  transition: color var(--dur) var(--ease);
}
.footer-links a:hover,
.footer-links button:hover { color: var(--ink); }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-hover);
  font-size: 13px;
  color: var(--ink);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Entrance
   ========================================================================== */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.reveal {
  animation: rise .55s var(--ease) backwards;
  animation-delay: var(--d, 0ms);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1199px) {
  .hero { padding-top: 64px; }
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .hero-search { max-width: 100%; }
}

@media (max-width: 959px) {
  .seg-full { display: none; }
  .seg-short { display: inline; }
  .seg-btn { min-width: 32px; padding: 0 8px; }
  .icon-btn { width: 44px; height: 44px; }
}

@media (max-width: 899px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 52px 0 44px; }
  .section-note { display: none; }
}

@media (max-width: 719px) {
  :root { --gutter: 16px; }

  .topbar-inner { gap: 10px; }
  .brand-divider { display: none; }
  .env-pill { display: none; }
  .icon-btn#helpToggle { display: none; }

  .hero { padding: 44px 0 36px; }
  h1 { font-size: clamp(38px, 10vw, 46px); }
  .hero-sub { font-size: 15px; margin-bottom: 22px; }
  .hero-updated { font-size: 10px; }
  .kbd { display: none; }
  .command { padding-right: 14px; }
  .command input { font-size: 16px; } /* prevents iOS focus zoom */

  .card { padding: 20px 18px 18px; min-height: 0; }
  .card-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .btn { width: 100%; height: 48px; }

  .quick { gap: 10px; }
  .quick a { height: 48px; }

  .footer { margin-top: 48px; }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .card:hover,
  .btn:hover,
  .btn:active { transform: none; }
  .dot.is-online { animation: none; }
  .reveal { animation-delay: 0ms !important; }
}

/* Theme cross-fade, only while switching (never on first paint) */
html.theme-fade *,
html.theme-fade *::before,
html.theme-fade *::after {
  transition:
    background-color 200ms var(--ease),
    border-color 200ms var(--ease),
    color 200ms var(--ease),
    box-shadow 200ms var(--ease) !important;
}
