/* Mayfair Skin for Mayfair AI.
   Same tokens as the rest of the Mayfair suite: Mayfair Black / Stone / Amber #ffa800, Inter,
   radii 8 (controls) and 16 (panels, dialogs), 6 (chips), no pills, heights 28 / 32 / 40,
   type scale 11 / 12 / 13.5 / 15 / 17 / 22 / 28, icon stroke 1.6, amber focus ring.
   Light and dark are two value sets of the same tokens and follow the device.
   Inter is self-hosted (SIL Open Font Licence, see fonts/INTER-LICENSE.txt). No third-party fonts. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/inter-Bold.woff") format("woff"); }

:root {
  color-scheme: light dark;
  /* colour (light) */
  --bg: #ffffff;
  --bg-soft: #f4f4f2;      /* Stone */
  --bg-soft2: #eaeae6;
  --panel: #f9f9f7;
  --text: #0a0a0a;         /* Mayfair Black */
  --muted: #5f5f5a;
  --border: #e4e4e0;
  --accent: #ffa800;       /* Mayfair Amber */
  --accent-text: #8f5500;  /* darker amber for small text on white (Deep Amber #b36b00 is 4.2:1, too weak for small text) */
  --accent-ring: #b36b00;  /* Deep Amber: focus ring on light surfaces */
  --accent-bg: #ffa800;
  --accent-bg-hover: #ffb81f;
  --on-accent: #0a0a0a;
  --accent-soft: rgba(255, 168, 0, 0.16);
  --danger: #c4262e;
  --danger-bg: #fdecec;
  --danger-border: #f1b8bb;
  --ok: #1e7a3a;
  --ok-bg: #e4f4e9;
  --warn-bg: #fff4d9;
  --warn-border: #f3d58a;
  --focus: var(--accent-ring);
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.06), 0 8px 28px rgba(10, 10, 10, 0.08);
  /* shape */
  --r-ctl: 8px;
  --r-chip: 6px;
  --r-panel: 16px;
  --radius: 16px;
  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13.5px; --fs-lg: 15px; --fs-xl: 17px; --fs-h2: 22px; --fs-h1: 28px;
  /* heights */
  --h-s: 28px; --h-m: 32px; --h-l: 40px; --h-field: 34px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --bg-soft: #1a1a18;
    --bg-soft2: #242422;
    --panel: #161614;
    --text: #f3f3f2;
    --muted: #a5a59e;
    --border: #2f2f2c;
    --accent-text: #ffa800;
    --accent-ring: #ffa800;
    --accent-soft: rgba(255, 168, 0, 0.14);
    --danger: #ff7b7f;
    --danger-bg: #2d1416;
    --danger-border: #6d2a2e;
    --ok: #6fd593;
    --ok-bg: #12301d;
    --warn-bg: #2b2208;
    --warn-border: #5f4a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 var(--fs-md)/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "calt", "kern";
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h2); }
a { color: var(--accent-text); text-underline-offset: 2px; }
code, pre, kbd { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-ctl); box-shadow: 0 0 0 5px var(--accent-soft); }
[hidden] { display: none !important; }

/* buttons: 28 / 32 / 40 high, radius 8, 13.5 px / 500; primary amber 600 */
.btn, .icon-btn {
  font: inherit; font-size: var(--fs-md); font-weight: 500; cursor: pointer; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 0 0.85rem; height: var(--h-m);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  text-decoration: none; white-space: nowrap;
}
.btn:hover, .icon-btn:hover { background: var(--bg-soft2); }
.btn:disabled, .icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-bg-hover); border-color: var(--accent-bg-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1a0507; } }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }
.btn-lg { height: var(--h-l); padding: 0 1.2rem; font-size: var(--fs-lg); }
.btn-sm { height: var(--h-s); padding: 0 0.65rem; font-size: var(--fs-sm); }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--accent-text); text-decoration: underline; }
.icon-btn { height: var(--h-m); min-width: var(--h-m); padding: 0 0.4rem; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--bg-soft2); }
.copy-btn { height: var(--h-s); min-width: var(--h-s); }
.copy-btn.copied { color: var(--ok); }
.copy-label { font-size: var(--fs-sm); }

/* fields: 34 high, radius 8, amber focus ring */
input[type=text], input[type=search], input[type=date], input[type=password], select, textarea {
  font: inherit; font-size: var(--fs-md); color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 0 0.7rem; height: var(--h-field); max-width: 100%;
}
textarea { height: auto; padding: 0.5rem 0.7rem; resize: none; width: 100%; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent-ring); }
input[type=date]:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--accent-ring); box-shadow: 0 0 0 5px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.9; }
.field-label { display: block; font-weight: 600; font-size: var(--fs-sm); margin: 0.9rem 0 0.3rem; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.field-row > .field { display: flex; flex-direction: column; gap: 0.25rem; }
.field-row .field-label { margin: 0; }

/* banners and chips (chips are radius 6, no pills) */
.banner {
  border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--text);
  border-radius: var(--r-ctl); padding: 0.65rem 0.85rem; margin: 0 0 1rem;
}
.banner-info { background: var(--bg-soft); border-color: var(--border); }
.banner-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.banner-danger strong { color: var(--danger); }
.banner-mock { background: repeating-linear-gradient(135deg, var(--warn-bg), var(--warn-bg) 10px, transparent 10px, transparent 20px); border: 1.5px dashed var(--accent-ring); }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-sm); font-weight: 600;
  padding: 0.12rem 0.55rem; border-radius: var(--r-chip); background: var(--accent-soft); color: var(--accent-text);
  white-space: nowrap;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-bad { background: var(--danger-bg); color: var(--danger); }
.chip-off { background: var(--bg-soft2); color: var(--muted); }

/* sign-in: dark left panel with headline and three points, card on the right */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.signin-side { background: #0a0a0a; color: #f3f3f2; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: center; gap: 1.6rem; position: relative; overflow: hidden; }
.signin-side::after { content: ""; position: absolute; right: -8rem; bottom: -8rem; width: 26rem; height: 26rem; background: radial-gradient(closest-side, rgba(255, 168, 0, 0.28), transparent); pointer-events: none; }
.signin-brand { font-weight: 700; font-size: var(--fs-xl); display: flex; align-items: center; gap: 0.55rem; letter-spacing: -0.01em; }
.signin-brand::before { content: ""; width: 4px; height: 1.15em; border-radius: 2px; background: #ffa800; }
.signin-side h2 { font-size: var(--fs-h1); line-height: 1.15; max-width: 22rem; margin: 0; letter-spacing: -0.025em; color: #fff; }
.signin-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; max-width: 24rem; position: relative; z-index: 1; }
.signin-points li { padding-left: 1.4rem; position: relative; color: #cfcfc9; font-size: var(--fs-lg); }
.signin-points li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 8px; height: 8px; border-radius: 2px; background: #ffa800; }
.signin-main { display: grid; place-items: center; padding: 1.5rem; }
.card { width: min(100%, 24rem); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 2rem 1.75rem; box-shadow: var(--shadow); }
.card h1 { font-size: var(--fs-h2); margin-bottom: 0.4rem; }
.card .btn { margin-top: 0.6rem; width: 100%; }
.card .btn-sm { width: auto; }
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.center-screen .card { text-align: left; }
.brand-title { font-size: var(--fs-h2); }
@media (max-width: 800px) {
  .signin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .signin-side { padding: 1.75rem 1.4rem; gap: 1rem; }
  .signin-side h2 { font-size: var(--fs-h2); }
  .signin-points { display: none; }
  .signin-side::after { display: none; }
}

/* thinking dots */
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.7; } * { scroll-behavior: auto !important; } }
.thinking { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }

/* dialogs: radius 16, 24 padding, title 17 / 600, default button amber */
dialog.dlg {
  border: 1px solid var(--border); border-radius: var(--r-panel); padding: 0; background: var(--bg); color: var(--text);
  width: min(94vw, 28rem); box-shadow: var(--shadow);
}
dialog.dlg-wide { width: min(94vw, 44rem); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg-inner { padding: 24px; max-height: 85vh; overflow: auto; }
.dlg-title { font-size: var(--fs-xl); font-weight: 600; }
.dlg-msg { margin: 0 0 0.5rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.dlg input[type=text], .dlg textarea, .dlg select { width: 100%; }

/* markdown */
.md { overflow-wrap: anywhere; font-size: var(--fs-lg); line-height: 1.6; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0.65em 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 1.1em 0 0.4em; }
.md h1 { font-size: var(--fs-h2); } .md h2 { font-size: var(--fs-xl); } .md h3 { font-size: var(--fs-lg); } .md h4, .md h5, .md h6 { font-size: var(--fs-md); }
.md ul, .md ol { padding-left: 1.5rem; margin: 0.5em 0; }
.md li { margin: 0.2em 0; }
.md blockquote { margin: 0.8em 0; padding: 0.1em 0 0.1em 0.9rem; border-left: 3px solid var(--accent); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md code { background: var(--bg-soft2); border-radius: var(--r-chip); padding: 0.08em 0.38em; font-size: 0.88em; }
.md-plain { white-space: pre-wrap; }
.code-block { margin: 0.8em 0; border: 1px solid var(--border); border-radius: var(--r-ctl); overflow: hidden; background: var(--bg-soft); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 0.15rem 0.35rem 0.15rem 0.8rem; background: var(--bg-soft2); font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.code-head .copy-btn { text-transform: none; letter-spacing: 0; font-weight: 500; }
.code-block pre { margin: 0; padding: 0.8rem; overflow: auto; font-size: 12.5px; line-height: 1.5; }
.code-block pre code { background: none; padding: 0; font-size: inherit; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 0.8em 0; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-ctl); }
.md table { border-collapse: collapse; min-width: 50%; width: 100%; font-size: var(--fs-md); }
.md th, .md td { border-bottom: 1px solid var(--border); padding: 0.45rem 0.8rem; text-align: left; vertical-align: top; }
.md tbody tr:last-child td { border-bottom: 0; }
.md th { background: var(--bg-soft); font-size: var(--fs-sm); font-weight: 600; }
.md .al-right { text-align: right; } .md .al-center { text-align: center; }

@media (forced-colors: active) {
  .btn-primary, .chip { border: 1px solid CanvasText; }
}
