/* Brev frontend — Dinu Barbu brand system.
   Tokens copied from design-system/tokens; square corners, no shadows,
   accent dosage: wordmark brackets, one primary CTA, one line in the terminal.
   Themes follow the design system: semantic aliases on :root (light),
   overridden under [data-theme="dark"]. Pair rule: Ember on light,
   Ember Light on dark — never the reverse. */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/SpaceGrotesk-latin.woff2") format('woff2');
}
@font-face {
  font-family: 'Azeret Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/AzeretMono-latin.woff2") format('woff2');
}

:root {
  --ink: #141414;
  --paper: #FAFAFA;
  --stone: #6E6E6E;
  --muted-on-dark: #9A9A9A;
  --muted-strong: #B5B5B5;
  --hairline-on-light: #E6E6E6;
  --hairline-on-dark: #2C2C2C;
  --panel: #1C1C1C;
  --inline-code-on-light: #EDEDED;
  --inline-code-on-dark: #262626;
  --shade-on-light: #F0F0F0;
  --shade-on-dark: #1B1B1B;
  --ember: #A8500F;
  --ember-light: #DE8A42;
  --ember-hover: #8A420C;

  --font-sans: 'Space Grotesk', sans-serif;
  --font-mono: 'Azeret Mono', monospace;
  --track-heading: -0.022em;
  --track-wordmark: -0.018em;

  /* Semantic aliases — light theme default */
  --surface-page: var(--paper);
  --surface-card: var(--inline-code-on-light);
  --surface-shade: var(--shade-on-light);
  --surface-code: var(--ink);       /* code sits directly on Ink, no border */
  --code-border: transparent;
  --input-bg: var(--paper);
  --text-body: var(--ink);
  --text-muted: var(--stone);
  --accent: var(--ember);
  --accent-on-hover: var(--ember-hover);
  --button-fill: var(--ember);
  --button-text: var(--paper);
  --button-hover: var(--ember-hover);
  --hairline: var(--hairline-on-light);
}

[data-theme="dark"] {
  --surface-page: var(--ink);
  --surface-card: var(--inline-code-on-dark);
  --surface-shade: var(--shade-on-dark);
  --surface-code: var(--panel);     /* code on Panel, with a hairline border */
  --code-border: var(--hairline-on-dark);
  --input-bg: var(--ink);
  --text-body: var(--paper);
  --text-muted: var(--muted-on-dark);
  --accent: var(--ember-light);
  --accent-on-hover: var(--ember-light); /* no darker hover defined on dark */
  --button-fill: var(--ember-light);
  --button-text: var(--ink);
  --button-hover: color-mix(in srgb, var(--ember-light) 85%, var(--ink));
  --hairline: var(--hairline-on-dark);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: 32px;
}

/* App wordmark — type only, ember-dot period is the accent moment */

.app-wordmark {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: var(--track-wordmark);
}

.app-wordmark .accent-dot {
  color: var(--accent);
  font-weight: 700;
}

.theme-toggle {
  display: inline-flex;
  align-self: center;
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  cursor: pointer;
}

.theme-toggle:hover { color: var(--text-body); }

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

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

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.wordmark {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: var(--track-wordmark);
  white-space: nowrap;
}

.wordmark .bracket {
  color: var(--accent);
  font-weight: 700;
}

.handle {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

a.handle:hover { color: var(--text-body); }

.gh-icon {
  margin-left: 6px;
  vertical-align: -2px;
}

/* Main column */

main { flex: 1; padding-bottom: 64px; }

h1 {
  margin: 72px 0 0;
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 500;
  letter-spacing: var(--track-heading);
  line-height: 1.05;
}

.lede {
  margin: 20px 0 0;
  max-width: 52ch;
  font-size: 17px;
}

.lede a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.lede a:hover { color: var(--accent-on-hover); }

/* Form card — flat neutral fill, square, no border, no shadow */

#shorten-form {
  margin-top: 48px;
  background: var(--surface-card);
  padding: 32px;
}

.field + .field { margin-top: 24px; }

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input {
  display: block;
  width: 100%;
  background: var(--input-bg);
  color: var(--text-body);
  border: 1px solid var(--hairline);
  border-radius: 0;
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
}

input:focus {
  outline: none;
  border-color: var(--text-body);
}

input::placeholder { color: var(--text-muted); opacity: 0.6; }

.field-note {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.button-primary {
  margin-top: 32px;
  background: var(--button-fill);
  color: var(--button-text);
  border: none;
  border-radius: 0;
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

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

.button-primary:disabled {
  background: var(--text-muted);
  cursor: default;
}

:is(button, input):focus-visible {
  outline: 2px solid var(--text-body);
  outline-offset: 2px;
}

/* Error — barely-there tint, plain body text; never accent-carried */

.error {
  margin: 24px 0 0;
  background: var(--surface-shade);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
}

/* Result — code surface: on Ink on light pages, on Panel with a hairline
   border on dark pages. The interior ramp is the same in both themes. */

#result { margin-top: 24px; }

.terminal {
  background: var(--surface-code);
  border: 1px solid var(--code-border);
  padding: 24px 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}

.terminal p { margin: 0; }

.terminal-prompt { color: var(--muted-on-dark); }

.terminal-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0;
}

.terminal-link {
  color: var(--ember-light);
  font-size: 15px;
  word-break: break-all;
  user-select: all;
}

.button-copy {
  flex: none;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--hairline-on-dark);
  border-radius: 0;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.button-copy:hover { border-color: var(--muted-on-dark); }

.button-copy:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

.terminal-comment { color: var(--muted-on-dark); }

.result-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Quote */

.quote {
  margin: 56px 0 0;
  padding-left: 20px;
  border-left: 1px solid var(--hairline);
}

.quote-line {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: var(--track-heading);
}

.quote-source {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Footer */

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 24px;
  border-top: 1px solid var(--hairline);
  padding-top: 20px;
  padding-bottom: 32px;
}

.site-footer .handle { justify-self: end; }

/* Quiet link — body text, 1px accent bottom border, → */

.footer-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-body);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}

.footer-link:hover { color: var(--accent-on-hover); }

@media (max-width: 500px) {
  .site-footer {
    grid-template-columns: 1fr 1fr;
    row-gap: 16px;
  }

  .site-footer .wordmark {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .site-footer .footer-link {
    justify-self: start;
  }
}
