/*
 * HeyCompu for Mac: account pages.
 * One stylesheet, no external assets. Every colour, radius and font is a token
 * on :root so the Mac brand can be swapped in later without touching rules.
 */

:root {
  color-scheme: light dark;

  /* Surfaces and text */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-muted: #efede8;
  --text: #1a1917;
  --text-muted: #5c5952;
  --border: #e1ded7;
  --border-strong: #b6b2a9;

  /* Actions */
  --accent: #1a1917;
  --accent-hover: #3a3833;
  --on-accent: #ffffff;
  --link: #1a1917;
  --link-underline: #a39f96;
  --focus: #2e6be6;

  /* Status */
  --ok: #1d6b45;
  --ok-soft: #e4f1e9;
  --info-soft: #eaeef6;
  --warn: #8a5200;
  --warn-soft: #faefdb;
  --danger: #b0261d;
  --danger-hover: #8f1f18;
  --danger-soft: #fae8e6;
  --on-danger: #ffffff;

  /* Meter */
  --meter-track: #e6e3dc;
  --meter-fill: #1a1917;
  --meter-high: #b86e00;
  --meter-full: #b0261d;

  /* Shape and type */
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(20 18 14 / 0.05), 0 6px 20px rgb(20 18 14 / 0.04);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 16px;
  --measure: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1c1b19;
    --surface-muted: #262522;
    --text: #edebe7;
    --text-muted: #aaa69d;
    --border: #33312d;
    --border-strong: #57544d;

    --accent: #edebe7;
    --accent-hover: #d4d1ca;
    --on-accent: #131312;
    --link: #edebe7;
    --link-underline: #77736b;
    --focus: #82a8ff;

    --ok: #74c99c;
    --ok-soft: #16271d;
    --info-soft: #1b2130;
    --warn: #e5ad57;
    --warn-soft: #2c2213;
    --danger: #f28b7f;
    --danger-hover: #f6a79e;
    --danger-soft: #33191a;
    --on-danger: #1f0b09;

    --meter-track: #302e2a;
    --meter-fill: #edebe7;
    --meter-high: #e5ad57;
    --meter-full: #f28b7f;

    --shadow: none;
  }
}

/* ------------------------------------------------------------------ base */

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
}

p,
ul,
dl {
  margin: 0 0 0.85rem;
}

p:last-child,
ul:last-child,
dl:last-child {
  margin-bottom: 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

main:focus,
[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

strong {
  font-weight: 650;
}

.break {
  overflow-wrap: anywhere;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.875rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

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

/* ---------------------------------------------------------------- layout */

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

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

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent);
  box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 7px var(--accent);
}

.brand-sub {
  color: var(--text-muted);
  font-weight: 500;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 550;
  font-size: 0.95rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-muted);
}

.main {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 48px;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
  padding: 20px 0;
}

.lede {
  font-size: 1.075rem;
  color: var(--text-muted);
  max-width: 40rem;
  margin-bottom: 1.5rem;
}

.lede strong {
  color: var(--text);
}

.section-title {
  margin-top: 1.75rem;
}

.split,
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  margin-bottom: 16px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 0 0 16px;
}

.split > .card,
.grid-2 > .card {
  margin: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 0.75rem;
}

.card-head h2 {
  margin: 0;
}

.card-danger {
  border-color: var(--danger);
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.more {
  font-weight: 600;
}

.more::after {
  content: " →";
  text-decoration: none;
  display: inline-block;
  margin-left: 2px;
}

.empty {
  color: var(--text-muted);
}

/* -------------------------------------------------------- banners, notes */

.banner {
  padding: 12px 16px;
  margin: 0 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.banner p {
  margin: 0;
}

.banner-ok {
  background: var(--ok-soft);
  border-color: var(--ok);
}

.banner-info {
  background: var(--info-soft);
}

.banner-warn {
  background: var(--warn-soft);
  border-color: var(--warn);
}

.callout {
  padding: 12px 14px;
  margin: 0 0 0.85rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--border-strong);
  background: var(--surface-muted);
}

.callout-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.note {
  font-size: 0.925rem;
  color: var(--text-muted);
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ----------------------------------------------------------------- forms */

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label:not(.check) {
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="text"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.form-status:empty {
  display: none;
}

.form-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--text);
  border-left: 4px solid var(--danger);
  font-size: 0.95rem;
}

.form-status[data-tone="ok"] {
  background: var(--ok-soft);
  border-left-color: var(--ok);
}

.code-form {
  max-width: 22rem;
}

/* --------------------------------------------------------------- buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 0.85rem;
}

.actions:last-child {
  margin-bottom: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 600 0.95rem/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button.small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
}

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

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

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

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

.button.quiet {
  background: transparent;
  color: var(--text);
}

.button.quiet:hover {
  background: var(--surface-muted);
}

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

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

.danger-text {
  color: var(--danger);
}

.button:disabled,
.button[aria-busy="true"] {
  opacity: 0.65;
  cursor: progress;
}

.form > .button {
  justify-self: start;
}

.link-button {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ------------------------------------------------------------- meter */

.meter-block {
  margin-bottom: 0.85rem;
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

.meter-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

meter {
  display: block;
  width: 100%;
  height: 12px;
  margin: 0 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
}

meter::-webkit-meter-inner-element {
  display: block;
}

meter::-webkit-meter-bar {
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--meter-track);
}

meter::-webkit-meter-optimum-value {
  background: var(--meter-fill);
  border-radius: 999px;
}

meter::-webkit-meter-suboptimum-value {
  background: var(--meter-high);
  border-radius: 999px;
}

meter::-webkit-meter-even-less-good-value {
  background: var(--meter-full);
  border-radius: 999px;
}

meter::-moz-meter-bar {
  background: var(--meter-fill);
  border-radius: 999px;
}

meter:-moz-meter-sub-optimum::-moz-meter-bar {
  background: var(--meter-high);
}

meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
  background: var(--meter-full);
}

.meter-text {
  margin-bottom: 0.35rem;
}

/* ------------------------------------------------------------ facts, lists */

.facts {
  display: grid;
  gap: 0;
  margin: 0 0 0.85rem;
  border-top: 1px solid var(--border);
}

.facts > div,
.kinds > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.facts dt,
.kinds dt {
  color: var(--text-muted);
}

.facts dd,
.kinds dd {
  margin: 0;
  font-weight: 550;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.subhead {
  margin-top: 1.25rem;
  font-size: 0.95rem;
}

.kinds {
  margin: 0 0 0.85rem;
  border-top: 1px solid var(--border);
}

.ticks {
  padding-left: 1.25rem;
}

.ticks li {
  margin-bottom: 0.3rem;
}

.ticks li::marker {
  color: var(--text-muted);
}

.price {
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

.price-amount {
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------- receipts */

.receipts {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.receipt {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.receipt p {
  margin: 0;
}

.receipt-main {
  min-width: 0;
}

.receipt-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.receipt-meta,
.receipt-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.model {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.receipt-cost {
  flex: none;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- devices */

.devices {
  margin: 0;
  padding: 0;
  list-style: none;
}

.device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.device-main {
  flex: 1 1 16rem;
  min-width: 0;
}

.device-main p {
  margin-bottom: 0.2rem;
}

.device-name {
  margin-bottom: 0.25rem;
}

.device .form-status {
  flex-basis: 100%;
}

.devices-revoked .device {
  box-shadow: none;
  background: transparent;
}

/* ------------------------------------------------------------- link a Mac */

.code {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font: 650 clamp(1.4rem, 1.1rem + 1.6vw, 1.9rem) / 1.2 var(--mono);
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.code-card p:first-child {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.code-card .code {
  margin: 0;
}

.result h2 {
  font-size: 1.35rem;
}

/* --------------------------------------------------------- small screens */

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

  .main {
    padding-top: 24px;
  }

  .card {
    padding: 18px 16px;
    border-radius: var(--radius);
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
  }

  .site-nav a {
    padding: 0 8px;
  }

  .site-nav > .button {
    margin-left: auto;
  }

  .actions .button {
    flex: 1 1 auto;
  }

  .facts dd,
  .kinds dd {
    text-align: left;
  }
}

/* ----------------------------------------------------------- preferences */

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

@media (forced-colors: active) {
  .button,
  .card,
  .pill,
  .callout,
  .banner,
  .form-status {
    border: 1px solid CanvasText;
  }

  .brand-mark {
    forced-color-adjust: none;
    background: CanvasText;
  }

  meter {
    forced-color-adjust: auto;
  }
}

@media print {
  .site-header,
  .site-footer,
  .actions,
  .skip-link {
    display: none;
  }

  .card {
    box-shadow: none;
  }
}
