/* digistamp.co hub.
   Tokens are copied from the DigiStamp Heritage Tech design system
   (assets/src/app/globals.css, assets/docs/design/DESIGN-SYSTEM.md) so the
   hub matches the family. Change them there first, then here. */

:root,
[data-theme="light"] {
  --ds-canvas: #f5f3ee;
  --ds-surface: #ffffff;
  --ds-surface-sunken: #ece9e2;
  --ds-line: #ddd9d0;
  --ds-line-strong: #857f73;
  --ds-ink: #171a20;
  --ds-ink-muted: #5c6370;
  --ds-ink-faint: #62686f;
  --ds-primary: #42448e;
  --ds-primary-hover: #36387a;
  --ds-on-primary: #ffffff;
  --ds-primary-ink: #42448e;
  --ds-primary-soft: #e9e9f5;
  --ds-chain: #0b74e3;
  --ds-chain-ink: #0a63c4;
  --ds-chain-soft: #e3eefb;
  --ds-success-ink: #0f716b;
  --ds-success-soft: #e1f2f0;
  --ds-danger-ink: #b92836;
  --ds-danger-soft: #f9e5e7;
  --ds-warning-ink: #9a4508;
  --ds-warning-soft: #fbeedb;
  --ds-premium: #c0a477;
  --ds-premium-ink: #7a6133;
  --ds-focus: #42448e;
  --ds-shadow: 0 1px 2px rgb(23 26 32 / 0.06), 0 8px 24px rgb(23 26 32 / 0.08);
  color-scheme: light;
}

/* No data-theme yet (before the script, or without JavaScript): follow the OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ds-canvas: #171a20;
    --ds-surface: #1f232b;
    --ds-surface-sunken: #12151a;
    --ds-line: #2e343e;
    --ds-line-strong: #727a87;
    --ds-ink: #f5f3ee;
    --ds-ink-muted: #a9b0b8;
    --ds-ink-faint: #8d95a0;
    --ds-primary: #a3a5f2;
    --ds-primary-hover: #b9baf6;
    --ds-on-primary: #171a20;
    --ds-primary-ink: #a3a5f2;
    --ds-primary-soft: #272a4a;
    --ds-chain: #5aa9ff;
    --ds-chain-ink: #5aa9ff;
    --ds-chain-soft: #132a45;
    --ds-success-ink: #4cc9bf;
    --ds-success-soft: #123331;
    --ds-danger-ink: #f08a92;
    --ds-danger-soft: #3b1c21;
    --ds-warning-ink: #f5b451;
    --ds-warning-soft: #3a2b12;
    --ds-premium: #c0a477;
    --ds-premium-ink: #c0a477;
    --ds-focus: #a3a5f2;
    --ds-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

[data-theme="dark"] {
  --ds-canvas: #171a20;
  --ds-surface: #1f232b;
  --ds-surface-sunken: #12151a;
  --ds-line: #2e343e;
  --ds-line-strong: #727a87;
  --ds-ink: #f5f3ee;
  --ds-ink-muted: #a9b0b8;
  --ds-ink-faint: #8d95a0;
  --ds-primary: #a3a5f2;
  --ds-primary-hover: #b9baf6;
  --ds-on-primary: #171a20;
  --ds-primary-ink: #a3a5f2;
  --ds-primary-soft: #272a4a;
  --ds-chain: #5aa9ff;
  --ds-chain-ink: #5aa9ff;
  --ds-chain-soft: #132a45;
  --ds-success-ink: #4cc9bf;
  --ds-success-soft: #123331;
  --ds-danger-ink: #f08a92;
  --ds-danger-soft: #3b1c21;
  --ds-warning-ink: #f5b451;
  --ds-warning-soft: #3a2b12;
  --ds-premium: #c0a477;
  --ds-premium-ink: #c0a477;
  --ds-focus: #a3a5f2;
  --ds-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: "Archivo", "Geist", ui-sans-serif, system-ui, sans-serif;
  font-stretch: 112%;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: var(--ds-primary-ink);
}

:focus-visible {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container { padding: 0 24px; }
}

@media (min-width: 1024px) {
  .container { padding: 0 32px; }
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--ds-primary);
  color: var(--ds-on-primary);
  border-radius: 6px;
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

.eyebrow {
  font-size: 0.75rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--ds-ink-muted);
  margin: 0 0 12px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-surface);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ds-ink);
  text-decoration: none;
  font-family: "Archivo", "Geist", sans-serif;
  font-stretch: 112%;
  font-weight: 600;
  font-size: 1.125rem;
}

.brand svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  display: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--ds-ink-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.header-nav a:hover {
  color: var(--ds-ink);
  background: var(--ds-surface-sunken);
}

@media (min-width: 768px) {
  .header-nav a { display: inline-block; }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 4px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: transparent;
  color: var(--ds-ink-muted);
  cursor: pointer;
  transition: color 150ms ease-out, background 150ms ease-out;
}

.theme-toggle:hover {
  color: var(--ds-ink);
  background: var(--ds-surface-sunken);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon,
.theme-toggle .icon-system {
  display: none;
}

[data-theme-choice="light"] .theme-toggle .icon-sun,
[data-theme-choice="dark"] .theme-toggle .icon-moon,
[data-theme-choice="system"] .theme-toggle .icon-system {
  display: block;
}

/* ---------- Hero ---------- */

.hero {
  padding: 64px 0 48px;
}

@media (min-width: 768px) {
  .hero { padding: 96px 0 64px; }
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.05;
  max-width: 18ch;
}

@media (min-width: 768px) {
  .hero h1 { font-size: 3.5rem; }
}

/* Signature detail: the champagne rule under the hero heading. */
.heritage-rule {
  width: 64px;
  height: 1px;
  border: 0;
  margin: 24px 0;
  background: var(--ds-premium);
}

.hero .lead {
  max-width: 42rem;
  margin: 0;
  font-size: 1.125rem;
  color: var(--ds-ink-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}

.button-primary {
  background: var(--ds-primary);
  color: var(--ds-on-primary);
}

.button-primary:hover {
  background: var(--ds-primary-hover);
}

.button-secondary {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border-color: var(--ds-line-strong);
}

.button-secondary:hover {
  background: var(--ds-surface-sunken);
}

/* ---------- Sections ---------- */

.section {
  padding: 48px 0;
  border-top: 1px solid var(--ds-line);
}

@media (min-width: 768px) {
  .section { padding: 64px 0; }
}

.section-head {
  margin-bottom: 32px;
  max-width: 42rem;
}

.section-head h2 {
  font-size: 1.5rem;
  line-height: 1.25;
}

.section-head p {
  margin: 8px 0 0;
  color: var(--ds-ink-muted);
}

/* ---------- Service cards ---------- */

.services {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .services { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .services { grid-template-columns: repeat(3, 1fr); }
}

.service {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.service:hover {
  border-color: var(--ds-line-strong);
  box-shadow: var(--ds-shadow);
}

.service-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ds-primary-soft);
  color: var(--ds-primary-ink);
}

.service-icon svg {
  width: 20px;
  height: 20px;
}

.service h3 {
  font-size: 1.125rem;
  line-height: 1.4;
}

/* The whole card is the link target; the heading link stretches over it. */
.service h3 a {
  color: var(--ds-ink);
  text-decoration: none;
}

.service h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

.service h3 a:focus-visible {
  outline: none;
}

.service:has(h3 a:focus-visible) {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
}

.service p {
  margin: 0;
  color: var(--ds-ink-muted);
  font-size: 0.9375rem;
}

.service-upcoming {
  border-style: dashed;
  border-color: var(--ds-line-strong);
  background: transparent;
}

.service-upcoming:hover {
  box-shadow: none;
}

.service-upcoming .service-host {
  font-family: inherit;
  color: var(--ds-ink-muted);
}

.service-host {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--ds-line);
  font-size: 0.8125rem;
  color: var(--ds-chain-ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-live {
  background: var(--ds-success-soft);
  color: var(--ds-success-ink);
}

.badge-beta {
  background: var(--ds-warning-soft);
  color: var(--ds-warning-ink);
}

.badge-infra {
  background: var(--ds-chain-soft);
  color: var(--ds-chain-ink);
}

/* ---------- Principles ---------- */

.principles {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .principles { grid-template-columns: repeat(3, 1fr); }
}

.principles li {
  padding-top: 16px;
  border-top: 1px solid var(--ds-line-strong);
}

.principles h3 {
  font-size: 1.125rem;
  line-height: 1.4;
  margin-bottom: 8px;
}

.principles p {
  margin: 0;
  color: var(--ds-ink-muted);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface);
  font-size: 0.875rem;
  color: var(--ds-ink-muted);
}

.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

.site-footer h2 {
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-stretch: normal;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ds-ink);
  margin-bottom: 12px;
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: 6px;
}

.site-footer a {
  color: var(--ds-ink-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ds-ink);
  text-decoration: underline;
}

.footer-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--ds-line);
  font-size: 0.8125rem;
}

.footer-note p {
  margin: 0;
}

/* Orange-Hat credit, as on the assets footer: the orange is a dot beside
   the name, never the text colour (#f97316 is 2.8:1 on the surface). */
.oh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ds-ink);
}

.oh-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #f97316;
}

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

/* A button that reads as a footer link (Feedback opens a dialog, so it is a
   button, not a link). */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ds-ink-muted);
  cursor: pointer;
}

.link-button:hover {
  color: var(--ds-ink);
  text-decoration: underline;
}

.link-button.inline {
  color: var(--ds-primary-ink);
  text-decoration: underline;
}

.muted {
  color: var(--ds-ink-muted);
  font-size: 0.875rem;
}

/* ---------- Feedback dialog ---------- */

.dialog {
  width: min(28rem, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  box-shadow: var(--ds-shadow);
}

.dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

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

.dialog-head h2 {
  font-size: 1.125rem;
  line-height: 1.4;
}

.dialog-head p {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--ds-ink-muted);
}

.dialog-close {
  display: inline-flex;
  padding: 6px;
  margin: -6px -6px 0 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ds-ink-muted);
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--ds-surface-sunken);
  color: var(--ds-ink);
}

.dialog-close svg {
  width: 20px;
  height: 20px;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--ds-line-strong);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.chip[aria-checked="true"] {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: var(--ds-on-primary);
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 4px;
}

.feedback-form textarea,
.feedback-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ds-line-strong);
  border-radius: 6px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.9375rem;
  resize: vertical;
}

.field-hint,
.field-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ds-ink-faint);
}

.field-meta {
  display: flex;
  justify-content: space-between;
}

.form-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--ds-danger-soft);
  color: var(--ds-danger-ink);
  font-size: 0.8125rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.dialog-actions .button,
.feedback-done .button {
  min-height: 40px;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.feedback-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0 8px;
}

.feedback-done[hidden],
.feedback-form[hidden] {
  display: none;
}

/* ---------- Tip page ---------- */

.tip-container {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 42rem;
  padding-top: 48px;
  padding-bottom: 64px;
}

.tip-head {
  text-align: center;
}

.tip-head h1 {
  font-size: 2rem;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .tip-head h1 { font-size: 2.5rem; }
}

.tip-head .heritage-rule {
  margin: 20px auto;
}

.tip-head .lead {
  margin: 0;
  color: var(--ds-ink-muted);
}

.tip-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  background: var(--ds-surface);
  text-align: center;
}

.tip-card img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff;
}

.tip-card .eyebrow {
  margin: 12px 0 0;
}

.tip-address {
  margin: 0;
  word-break: break-all;
  font-size: 0.875rem;
  color: var(--ds-chain-ink);
}

.tip-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tip-actions .button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.tip-actions .button[hidden] {
  display: none;
}

.tip-card .amount {
  font-weight: 600;
  color: var(--ds-ink);
}

.presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  .presets { grid-template-columns: repeat(5, 1fr); }
}

.preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  text-decoration: none;
  font-size: 0.875rem;
}

.preset span {
  font-size: 0.75rem;
  color: var(--ds-ink-muted);
}

.preset:hover {
  border-color: var(--ds-line-strong);
}

.preset[aria-current="true"] {
  border-color: var(--ds-primary);
  background: var(--ds-primary-soft);
}

.tip-note {
  padding: 16px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: var(--ds-surface-sunken);
  font-size: 0.875rem;
}

.tip-note p {
  margin: 0;
}

.tip-note p + p {
  margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
