/*
 * spec-card.css
 *
 * Presentation rules live in CSS modules, not inline HTML style blocks.
 * Keep light mode, dark mode (html.dark-mode), and print behavior together
 * with the component/page rules they affect.
 */

/* Extracted from _includes/spec-card-form.html. */

  /* Spec Card widget — light mode (default).
     Note on units: this site sets `html { font-size: 62.5% }` so 1rem = 10px,
     while body/paragraph text actually renders at ~22.5px (set further down).
     Using `rem` shrinks the widget to ~10px text. Widgets that sit inside
     <article>/<main> inherit body's 16px, NOT the paragraph 22.5px (since the
     widget isn't a <p>). So we explicitly set the widget's base to 1.4em
     (≈22.4px from body's 16px) to match paragraph size, then size everything
     else inside with `em` (relative to the widget). See AGENTS.md "Minimum
     font sizes" section. */
  .spec-card-widget {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #d9dee8;
    border-radius: 10px;
    padding: 20px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(31, 41, 55, 0.06);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Match surrounding paragraph size (~22.4px). */
    font-size: 1.4em;
    line-height: 1.5;
    max-width: 720px;
  }

  .spec-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
  }

  /* Title is an <h2>; scope to .spec-card-widget to keep its compact widget
     sizing instead of inheriting the layout's full-page h2 rule. The h1 of
     the host page sits directly above, so h3 here would skip a level (WCAG
     2.4.6 / 1.3.1). */
  .spec-card-widget .spec-card-title {
    margin: 0;
    font-size: 1.2em;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
  }

  .spec-card-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.95em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 80px;
    text-align: center;
  }
  .spec-card-status[data-state="saved"] {
    background: #d1fae5;
    color: #065f46;
  }
  .spec-card-status[data-state="saving"] {
    background: #fef3c7;
    color: #92400e;
  }

  .spec-card-desc {
    margin: 0 0 16px;
    color: #4b5563;
    /* font-size inherits — matches surrounding paragraph */
    line-height: 1.55;
  }

  .spec-card-form {
    display: grid;
    gap: 16px;
    margin: 0;
  }

  .spec-card-field { display: grid; gap: 6px; }

  /* Browsers (and some site stylesheets) shrink <label> font-size by
     default. Force it back to the widget's paragraph size. */
  .spec-card-widget .spec-card-field label {
    display: grid;
    gap: 4px;
    font-size: 1em;
  }

  .spec-card-widget .spec-card-field-name {
    font-weight: 700;
    color: #1f2937;
    font-size: 1em;
  }

  .spec-card-widget .spec-card-field-hint {
    font-size: 0.95em;       /* secondary text — slightly smaller than paragraph */
    font-weight: 400;
    color: #6b7280;
    line-height: 1.45;
  }

  .spec-card-widget input[type="text"],
  .spec-card-widget textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    /* `font: inherit` makes the input adopt the widget's family + size,
       so typed content is the same size as the surrounding paragraph. */
    font: inherit;
    line-height: 1.5;
    box-sizing: border-box;
    resize: vertical;
  }

  .spec-card-widget textarea {
    min-height: 72px;
    /* Override family back to monospace, but keep inherited font-size. */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  }

  .spec-card-widget input[type="text"]:focus-visible,
  .spec-card-widget textarea:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: #2563eb;
  }

  .spec-card-widget input[type="text"]::placeholder,
  .spec-card-widget textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
  }

  .spec-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
  }

  .spec-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #f3f4f6;
    color: #1f2937;
    /* Inherit family + size from widget so labels match surrounding text. */
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
  }
  .spec-card-btn:hover { background: #e5e7eb; }
  .spec-card-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }
  .spec-card-btn:disabled { opacity: 0.55; cursor: not-allowed; }

  .spec-card-btn-primary {
    background: #2563eb;
    color: #ffffff;
  }
  .spec-card-btn-primary:hover { background: #1d4ed8; }

  .spec-card-btn-danger {
    background: #ffffff;
    color: #b91c1c;
    border-color: #fecaca;
    margin-left: auto;
  }
  .spec-card-btn-danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
  }

  /* Dark-mode overrides — applies whenever <html> has .dark-mode */
  html.dark-mode .spec-card-widget {
    background: #232a36;
    color: #e6edf3;
    border-color: #2a323e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }
  html.dark-mode .spec-card-header { border-bottom-color: #2a323e; }
  html.dark-mode .spec-card-title { color: #f3f4f6; }

  html.dark-mode .spec-card-status {
    background: #2a323e;
    color: #cbd5e1;
  }
  html.dark-mode .spec-card-status[data-state="saved"] {
    background: #064e3b;
    color: #a7f3d0;
  }
  html.dark-mode .spec-card-status[data-state="saving"] {
    background: #78350f;
    color: #fde68a;
  }

  html.dark-mode .spec-card-desc { color: #9ca3af; }
  html.dark-mode .spec-card-field-name { color: #e6edf3; }
  html.dark-mode .spec-card-field-hint { color: #9ca3af; }

  html.dark-mode .spec-card-widget input[type="text"],
  html.dark-mode .spec-card-widget textarea {
    background: #1c2533;
    color: #e6edf3;
    border-color: #3a4351;
  }
  html.dark-mode .spec-card-widget input[type="text"]::placeholder,
  html.dark-mode .spec-card-widget textarea::placeholder {
    color: #6b7280;
  }
  html.dark-mode .spec-card-widget input[type="text"]:focus-visible,
  html.dark-mode .spec-card-widget textarea:focus-visible {
    outline-color: #60a5fa;
    border-color: #60a5fa;
  }

  html.dark-mode .spec-card-actions { border-top-color: #2a323e; }

  html.dark-mode .spec-card-btn {
    background: #2a323e;
    color: #e6edf3;
  }
  html.dark-mode .spec-card-btn:hover { background: #374151; }
  html.dark-mode .spec-card-btn:focus-visible { outline-color: #60a5fa; }

  html.dark-mode .spec-card-btn-primary {
    background: #2563eb;
    color: #ffffff;
  }
  html.dark-mode .spec-card-btn-primary:hover { background: #1d4ed8; }

  html.dark-mode .spec-card-btn-danger {
    background: #1c2533;
    color: #fca5a5;
    border-color: #7f1d1d;
  }
  html.dark-mode .spec-card-btn-danger:hover {
    background: #2a1414;
    border-color: #b91c1c;
  }

  /* High-contrast and reduced-motion respect */
  @media (prefers-reduced-motion: reduce) {
    .spec-card-btn { transition: none; }
  }

