/* The product's shared parts: the pieces every page draws the same way, defined once in the brand's tokens
   (brand.css) and loaded right after it and the header and footer (chrome.css), before a page's own stylesheet.
   It holds the focus ring, buttons and Copy as the website draws them; a page's stylesheet places them in its own
   layout and never restyles them. Both hosts serve it (apps/website/delivery.json, sharedFiles). DESIGN.md,
   Components, names what it owns; docs/plans/shared-components.md says why it exists. */

/* Focus: the orange ring a keyboard sees on every control. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 500 15px / 1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease),
    background-color 0.2s,
    border-color 0.2s,
    box-shadow 0.3s;
}
.btn .icon {
  width: 18px;
  height: 18px;
  transition: transform 0.3s var(--ease);
}
.btn svg:has(use[href="#i-arrow"]) {
  display: none;
}
/* Long translated labels wrap on phones instead of running past the screen edge. */
@media (max-width: 480px) {
  .btn {
    height: auto;
    min-height: 48px;
    padding-block: var(--space-3);
    line-height: var(--lh-snug);
    text-align: center;
    white-space: normal;
  }
}
.btn-ink {
  background: var(--ink);
  color: var(--paper);
}
.btn-ink:hover {
  background: #2a292e;
}
.btn-ghost {
  border-color: var(--line-strong);
  background: var(--white);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--white);
}
.btn-ghost .icon-solid {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.btn-lg {
  height: 54px;
  padding: 0 24px;
  font-size: 16px;
}
.btn-sm {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
}
.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  font: 500 13px / 1 var(--sans);
  color: var(--ink);
  white-space: nowrap;
}
.btn-mini .icon {
  width: 11px;
  height: 11px;
  color: var(--accent);
}
.btn-mini-ink {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
button.btn-mini {
  cursor: pointer;
  transition:
    border-color 0.2s,
    background-color 0.2s,
    transform 0.15s;
}
button.btn-mini:hover {
  border-color: var(--ink);
}
button.btn-mini-ink:hover {
  background: #000;
}
button.btn-mini:active {
  transform: translateY(1px);
}
button.btn-mini[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent-text);
}
button.btn-mini:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Copy: a button that copies a text, says Copied and goes back to Copy. */
.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 34px;
  flex: none;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  font: 500 13px / 1 var(--sans);
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}
.copy .icon {
  width: 15px;
  height: 15px;
}
.copy:hover {
  border-color: var(--ink);
}
.copy.is-copied {
  border-color: #d3e0cf;
  background: #edf3ea;
  color: var(--sage);
}
.copy-quiet {
  height: 30px;
  padding: 0 12px;
  border-color: var(--line);
  background: transparent;
  font-size: 13px;
}
.copy-inline {
  width: 26px;
  height: 26px;
  margin-left: var(--space-1);
  padding: 0;
  vertical-align: middle;
}
.copy-inline .icon {
  width: 13px;
  height: 13px;
}
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  line-height: var(--lh-snug);
  box-shadow: 0 18px 40px -18px rgba(36, 40, 34, 0.65);
  transform: translateX(-50%);
  transition:
    opacity 0.25s,
    transform 0.35s var(--ease);
}
.copy-toast:empty {
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}
.btn-mini-ghost {
  gap: var(--space-2);
  border-color: var(--night-line);
  background: transparent;
  color: var(--on-night);
  text-decoration: none;
  transition: border-color 0.2s;
}
.btn-mini-ghost:hover {
  border-color: var(--line-strong);
}
.btn-mini-ghost .icon {
  width: 13px;
  height: 13px;
  color: var(--accent-night);
}

/* The app's buttons (its own pages, at their 40px density): one ink button for the step a page is about; the quiet
   ones beside it are raised on white with a hairline ring dark enough to read as a button on a white page (owner,
   2026-10-30), deepening on hover, never an outline. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 0 0 1px var(--hair-strong);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: var(--lh-heading);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.2s,
    box-shadow 0.2s,
    color 0.2s;
}
.button:hover:not(:disabled) {
  box-shadow: 0 0 0 1px var(--line-strong);
}
/* Ringed in its own ink, so its edge meets a quiet button's ring beside or under it. */
.button.primary {
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
  color: var(--page-paper);
}
.button.primary:hover:not(:disabled) {
  background: var(--ink-soft);
  box-shadow: 0 0 0 1px var(--ink-soft);
}
.button.small {
  min-height: 36px;
  padding: 8px 12px;
}
.button.big {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 15px;
}
.button.block {
  width: 100%;
}
.button svg {
  flex: none;
  width: 18px;
  height: 18px;
}
/* Copied, as the website's Copy: a sage tint and a tick that pops in, and Copy again 2.5 seconds later
   (apps/app/shared/clipboard.js). */
.button.is-copied,
.button.is-copied:hover:not(:disabled) {
  background: color-mix(in srgb, var(--sage) 12%, var(--white));
  box-shadow: none;
  color: var(--sage);
}
.button.primary.is-copied,
.button.primary.is-copied:hover:not(:disabled) {
  background: var(--sage);
  box-shadow: 0 0 0 1px var(--sage);
  color: var(--page-paper);
}
.button.is-copied svg {
  animation: tick-pop 0.66s var(--ease-spring);
}
/* The pressed button spins while its request runs and while the next page loads. */
.button.busy {
  position: relative;
  color: transparent;
}
.button.busy:disabled {
  opacity: 1;
}
.button.busy svg {
  visibility: hidden;
}
.button.busy::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.button.primary.busy::after {
  border-color: color-mix(in srgb, var(--page-paper) 30%, transparent);
  border-top-color: var(--page-paper);
}
.link {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* Fields: a small label over a white field with a hairline ring, wherever it sits. A field is there to be typed into,
   and a grey one reads as switched off (owner, 2026-10-30). Focused, the ring deepens into a double one, with no
   outline. */
.field {
  display: block;
  margin: 0 0 var(--space-4);
}
.field > span {
  display: block;
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.field :is(input, select) {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background-color: var(--white);
  box-shadow: 0 0 0 1px var(--hair-strong);
  outline: none;
  transition: box-shadow 0.2s;
}
.field :is(input, select):focus {
  box-shadow: var(--ring-focus);
}
/* A choice from a list keeps the field's look, with the app's chevron in place of the browser's arrow. */
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2367666b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  cursor: pointer;
}
.field .field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: 13px;
}
.field-head label {
  font-weight: 500;
  color: var(--muted);
}
.field-head .link {
  font-size: 13px;
}

/* A tone panel: related things grouped on a fill a step darker than the page, with no frame. Inside it a track is a
   step darker again; fields and quiet buttons stay white. */
.tone-panel {
  --track-fill: var(--layer-2);
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--layer-1);
}

/* A disclosure: the summary with an orange plus that turns into a cross, and the body glides open where the browser
   can animate to an auto height (elsewhere it opens at once). */
details.disclosure {
  interpolate-size: allow-keywords;
}
details.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  list-style: none;
  cursor: pointer;
}
details.disclosure > summary::-webkit-details-marker {
  display: none;
}
details.disclosure > summary::after {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 14px 1.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 1.5px 14px no-repeat;
  transition: transform 0.35s var(--ease);
}
details.disclosure[open] > summary::after {
  transform: rotate(45deg);
}
details.disclosure::details-content {
  block-size: 0;
  overflow: clip;
  transition:
    block-size 0.3s var(--ease),
    content-visibility 0.3s allow-discrete;
}
details.disclosure[open]::details-content {
  block-size: auto;
}

/* Choosing one of a few: a track a tone darker than what it sits on, with the chosen option raised on white; it
   settles into place without a bounce. The page places the track. */
.term-switch {
  display: flex;
  width: fit-content;
  gap: var(--space-1);
  padding: 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--track-fill, var(--layer-1));
}
.term-switch label {
  position: relative;
}
.term-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.term-switch span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition:
    background-color 0.32s var(--ease-settle),
    box-shadow 0.32s var(--ease-settle),
    color 0.2s;
}
.term-switch b {
  font-weight: 500;
  color: var(--accent-text);
}
.term-switch input:checked + span {
  background: var(--chosen);
  color: var(--ink);
  box-shadow:
    var(--ring),
    0 1px 2px rgba(15, 14, 18, 0.06);
}
.term-switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .tone-panel {
    padding: 20px;
  }
}
@media (max-width: 520px) {
  .button,
  .button.small {
    min-height: 44px;
  }
  .field :is(input, select) {
    height: 44px;
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .button.busy::after {
    animation-duration: 2.4s;
  }
  .button.is-copied svg {
    animation: none;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dark theme. */
[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.03);
}
[data-theme="dark"] .btn-ink:hover {
  background: #fff;
}
[data-theme="dark"] .copy.is-copied {
  border-color: rgba(141, 183, 149, 0.32);
  background: rgba(141, 183, 149, 0.1);
  color: var(--sage);
}
[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a199' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
}
/* Light type on dark paper reads heavier, so the app's parts step 40 lighter outside the Han, kana and hangul
   editions, as the website's do (owner, 2026-10-25). */
:root[data-theme="dark"]:not(:lang(zh), :lang(ja), :lang(ko)) :is(.button, .field > span, .field-head label) {
  font-weight: 460;
}

/* Public pages layer tone instead of drawing ink frames (owner, 2026-10-25). */
.public-page main :is(.btn, .btn-mini, .copy) {
  border-radius: var(--radius-xs);
}
.public-page main .btn-ink {
  border-color: var(--ink);
}
/* A quiet button is raised on white with a hairline ring, never an ink outline. */
.public-page main .btn-ghost,
.public-page main :is(.btn-mini, .copy):not(.btn-mini-ink) {
  border-color: transparent;
  background: var(--white);
  box-shadow: var(--ring);
  transition:
    box-shadow 0.2s,
    background-color 0.2s,
    color 0.2s;
}
.public-page main :is(.code, .ask) .copy {
  color: var(--ink);
}
.public-page main .btn-ghost:hover,
.public-page main :is(.btn-mini, .copy):not(.btn-mini-ink, .is-copied):hover {
  border-color: transparent;
  box-shadow: 0 0 0 1px var(--hair-strong);
}
.public-page main .copy.is-copied {
  border-color: transparent;
  background: color-mix(in srgb, var(--sage) 12%, var(--white));
  box-shadow: none;
  color: var(--sage);
}
/* Copied: the tick pops in with a small bounce, and the button says Copy again 2.5 seconds later. */
.public-page main .copy.is-copied .icon {
  animation: tick-pop 0.66s var(--ease-spring);
}
@keyframes tick-pop {
  from {
    transform: scale(0.4);
  }
}
