/* Emberwick Energy: the look of the page, loaded after styles.css. System fonts only. The core is the same on all three sites
   (a test keeps it so); the rest is this site's own character. */
/* ===== design core: the same on all three sites ===== */
:root {
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-1: none;
  --shadow-2: 0 18px 40px -26px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
  --ring: color-mix(in srgb, var(--brand-ink) 34%, transparent);
  --font-body: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
::selection { background: color-mix(in srgb, var(--brand-ink) 36%, transparent); }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
body { font-family: var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; line-height: 1.6; }
h1, h2, h3 { font-family: var(--font-display, inherit); font-weight: var(--display-weight, 700); letter-spacing: var(--display-tracking, -0.01em); text-wrap: balance; }
p, li { text-wrap: pretty; }
main section > p, main section > ul, .assistant-note { max-width: 68ch; }
.assistant-note { color: var(--muted); font-size: 0.93em; }
.intro p:not(.eyebrow):not(.note) { color: var(--muted); }

/* The page's own forms: a clear focus ring, and buttons that answer a press. */
section:not(.assistant) :is(input, select) { transition: border-color 0.15s, box-shadow 0.15s; }
section:not(.assistant) :is(input, select):focus-visible { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--ring); }
section:not(.assistant) button { transition: transform 0.15s var(--ease), background-color 0.15s, filter 0.15s; }
section:not(.assistant) button:active { transform: translateY(1px); }

/* The assistant on a laptop: the chat, the chats list and the swarm are raised panels. */
@media (min-width: 761px) {
  #agent-app .ns-chat { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); overflow: hidden; }
  .swarm-map, .chat-list { border-radius: var(--radius); box-shadow: var(--shadow-1); }
  /* The settings sit under the chat, in the chat's own column: they start after the chats list and stop before
     the swarm. The widths are the grid's in styles.css (a 176px or 200px list, a 360px swarm, a 16px gap). */
  #agent-app { --row-left: 0px; --row-right: 0px; }
  #agent-app:has(.swarm-map:not([hidden])) { --row-right: 376px; }
  #agent-app > [data-ns-slot="settings"] { margin-inline: calc(50% - min(760px, 50vw - 24px) + var(--row-left)) calc(50% - min(760px, 50vw - 24px) + var(--row-right)); }
  /* The developer log is wide, so it takes the whole row. */
  #agent-app > [data-ns-slot="agents"] { margin-inline: calc(50% - min(760px, 50vw - 24px)); }
  #agent-app > [data-ns-slot="settings"] > details { margin-top: 16px; padding: 4px 20px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  #agent-app > [data-ns-slot="settings"] > details > summary { padding: 10px 0; cursor: pointer; }
  #agent-app .ns-msg.bot { border-radius: var(--radius) var(--radius) var(--radius) 3px; }
  #agent-app .ns-msg.user { border-radius: var(--radius) var(--radius) 3px var(--radius); }
}

@media (min-width: 1101px) {
  #agent-app:has(.chat-side:not([hidden])) { --row-left: 192px; }
  #agent-app:has(.chat-side:not([hidden])):has(.swarm-map[hidden]) { --row-left: 216px; }
}

/* The logos drawn in SVG (js/brand-logos.js): in the chat header, in a tooltip and in the swarm graph. */
.brand-logo { display: inline-block; flex: none; width: 1.05em; height: 1.05em; margin-right: 0.4em; vertical-align: -0.18em; color: var(--brand-ink); overflow: visible; }
.swarm-logo { color: #fff; pointer-events: none; }
.swarm-site-label .swarm-logo { color: var(--site); }
.swarm-tip-head .brand-logo { width: 0.95em; height: 0.95em; margin: 0 0.25em 0 0; vertical-align: -0.12em; }

/* One moment of motion: the top of the page settles in once, and only for visitors who allow motion. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes settle { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  .swarm-node[data-state="running"] .brand-logo-spin { animation: swarm-spin 2.4s linear infinite; transform-box: fill-box; transform-origin: center; }
  .intro > * { animation: settle 0.7s var(--ease) both; }
  .intro > :nth-child(2) { animation-delay: 0.06s; }
  .intro > :nth-child(3) { animation-delay: 0.12s; }
  .intro > :nth-child(4) { animation-delay: 0.18s; }
}
/* ===== end of the design core ===== */

/* ===== Emberwick Energy: a utility statement. A bookish serif, an ember that glows along the header, an account summary laid out like a receipt, and tariffs as rate cards. ===== */
:root {
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display-weight: 700;
  --display-tracking: -0.02em;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-2: 0 26px 50px -32px rgba(70, 28, 6, 0.5);
  --ember: #ff8a3d;
  --paper: #f4f2ef; --surface: #ffffff; --surface-2: #f8f4ee; --line: #ddd4ca;
  --ink: #261b14; --muted: #6a5c50; --tint: #fcefe2;
  --brand-ink: #a63a0f; --brand-solid: #a63a0f;
}
:root[data-theme="dark"] {
  --paper: #16110d; --surface: #1f1813; --surface-2: #2a211a; --line: #3b2f26;
  --ink: #f5ece2; --muted: #ae9f91; --tint: #2e1e12;
  --brand-ink: #ff9d57; --brand-solid: #c2410c;
  --shadow-2: 0 30px 60px -34px #000;
}
body {
  background:
    radial-gradient(760px 380px at 100% 60px, color-mix(in srgb, var(--ember) 13%, transparent), transparent 70%) no-repeat,
    var(--paper);
}
main { padding-top: 6px; }
section { margin-top: 64px; }

/* Header: no colour block. The wordmark, quiet links, and a line that glows like an element. */
header { position: relative; padding: 20px 28px; background: transparent; border-bottom: 1px solid var(--line); }
header::after { content: ""; position: absolute; left: 0; bottom: -1px; width: min(44%, 520px); height: 2px; background: linear-gradient(90deg, var(--ember), transparent); }
header a { color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-size: 1.45em; letter-spacing: -0.01em; }
.brand::before { content: ""; flex: none; width: 17px; height: 17px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #ffe3bf, var(--ember) 48%, #c2410c); box-shadow: 0 0 16px 3px color-mix(in srgb, var(--ember) 55%, transparent); }
.brand span { font-weight: 400; font-style: italic; color: var(--muted); }
header nav { gap: 6px 26px; font-size: 0.95em; }
header nav a {
  padding: 4px 0; color: var(--muted); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.25s var(--ease), color 0.2s;
}
header nav a:hover, header nav a:focus-visible { color: var(--ink); background-size: 100% 1px; text-decoration: none; }
.theme-switch { border-color: var(--line); color: var(--ink); }
.theme-switch:hover, .theme-switch:focus-visible { background: var(--surface-2); }
.theme-switch:focus-visible { outline-color: var(--brand-ink); }
.theme-track { background: var(--line); }
.theme-switch[aria-checked="true"] .theme-track { background: var(--brand-ink); }
.theme-knob { background: var(--ink); }
.theme-switch[aria-checked="true"] .theme-knob { background: var(--paper); }

/* The top of the page: a large statement, and the account beside it like a receipt. */
.eyebrow { margin: 48px 0 10px; font-size: 0.9em; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 8px var(--ember); }
h1 { font-size: clamp(2.1em, 5.2vw, 3.6em); line-height: 1.06; margin: 0 0 22px; }
h2 { font-size: 1.75em; line-height: 1.15; margin: 0 0 14px; }
h3 { font-family: var(--font-display); font-weight: 700; }
.note { padding: 14px 18px; border: 0; border-left: 3px solid var(--ember); border-radius: 2px var(--radius-sm) var(--radius-sm) 2px; background: var(--tint); font-size: 0.93em; }
.summary { display: block; margin: 0; padding: 26px 28px 14px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ember); border-radius: 3px var(--radius) var(--radius) var(--radius); box-shadow: var(--shadow-2); }
.summary dt { margin: 14px 0 2px; color: var(--muted); font-size: 0.82em; font-weight: 600; }
.summary dd { margin: 0; padding-bottom: 13px; border-bottom: 1px dotted var(--line); font-family: var(--font-display); font-size: 1.12em; line-height: 1.35; font-feature-settings: "lnum"; }
.summary dd:last-of-type { border-bottom: 0; }
@media (min-width: 900px) {
  .intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr); grid-template-areas: "kicker summary" "title summary" "note summary" "free summary"; column-gap: 64px; align-items: start; }
  .intro > .eyebrow { grid-area: kicker; }
  .intro > h1 { grid-area: title; }
  .intro > .note { grid-area: note; }
  .intro > .summary { grid-area: summary; margin-top: 56px; }
}

/* Section headings: a short ember bar, not a pill or a rule across the page. */
main section > h2::after { content: ""; display: block; width: 36px; height: 3px; margin-top: 12px; border-radius: 2px; background: var(--ember); }

/* The usage chart: a ledger with faint rules, and bars that warm toward the top. */
.bars { gap: 10px; height: 190px; padding: 22px 22px 12px; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  background-image: repeating-linear-gradient(to top, transparent 0 41px, color-mix(in srgb, var(--line) 70%, transparent) 41px 42px); background-origin: content-box; }
.bars .bar { width: 58%; border-radius: 3px 3px 0 0; background: linear-gradient(to top, #b8400f, var(--ember)); transition: filter 0.2s; }
.bars > div:hover .bar { filter: brightness(1.18); }
.bars > div { font-size: 0.78em; }

/* Tariffs as rate cards: the name, then the price, then the terms. */
.card-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 3px; padding: 22px 22px 20px; border-radius: var(--radius); background: var(--surface); transition: transform 0.22s var(--ease), border-color 0.22s; }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--ember) 60%, var(--line)); }
.card h3 { order: -2; margin: 0; font-size: 1.3em; }
.card .strong { order: -1; margin: 4px 0 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); color: var(--brand-ink); font-family: var(--font-display); font-size: 1.12em; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.card p { color: var(--muted); }
.card .rule { color: var(--brand-ink); }
.card > button { margin-top: auto; }
.card > p:last-of-type { margin-bottom: 14px; }
.card.current { border-color: var(--ember); background: linear-gradient(180deg, color-mix(in srgb, var(--ember) 12%, var(--surface)), var(--surface) 60%); box-shadow: 0 0 0 1px var(--ember), 0 22px 44px -30px color-mix(in srgb, var(--ember) 70%, transparent); }

/* Forms and buttons. */
section:not(.assistant) > form { max-width: 560px; gap: 8px; padding: 26px 28px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
section:not(.assistant) label { font-size: 0.9em; margin-top: 6px; }
section:not(.assistant) :is(input, select) { padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); }
section:not(.assistant) button:not([role="tab"]) { padding: 11px 22px; border-radius: 999px; background: var(--brand-solid); font-weight: 650; letter-spacing: 0.01em; }
section:not(.assistant) button:not([role="tab"]):hover, section:not(.assistant) button:not([role="tab"]):focus-visible { filter: none; background: color-mix(in srgb, var(--brand-solid) 82%, #fff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ember) 28%, transparent); }
.result { border: 0; border-left: 3px solid var(--ember); border-radius: 2px var(--radius) var(--radius) 2px; padding: 14px 18px; }
#partner-list { list-style: none; padding: 0; }
#partner-list li { padding: 12px 0; border-bottom: 1px dotted var(--line); }
#partner-list a { font-family: var(--font-display); font-size: 1.1em; font-weight: 700; }

/* The assistant. */
.assistant { padding-top: 8px; }
footer { padding: 34px 24px 48px; line-height: 1.75; }
section:not(.assistant) .card > button { align-self: flex-start; padding: 8px 16px; font-size: 0.9em; background: transparent; color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand-ink) 55%, transparent); }
section:not(.assistant) .card > button:hover, section:not(.assistant) .card > button:focus-visible { background: var(--brand-ink); color: var(--paper); box-shadow: none; }
#partner-list a { display: block; }
#partner-list span { color: var(--muted); }
.assistant > p { max-width: 68ch; }
.assistant > p:first-of-type { font-size: 1.1em; }
.assistant-note { padding-left: 14px; border-left: 2px solid var(--line); }
@media (max-width: 760px) {
  html body[data-view="page"] header nav a { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); background-image: none; }
  .summary { padding: 20px 20px 10px; }
}
