/* ============================================================
   Self-hosted webfonts — Latin subset, WOFF2 (see Typography Spec §1)
   Files in /assets/fonts/. font-display:swap → instant fallback, no FOIT.
   ============================================================ */
/* Inter — body + UI */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/inter-400.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/assets/fonts/inter-500.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/assets/fonts/inter-600.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/assets/fonts/inter-700.woff2") format("woff2");
}
/* Source Serif 4 — editorial italic (date line, leads) */
@font-face {
    font-family: "Source Serif 4";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/source-serif-4-italic.woff2") format("woff2");
}
/* JetBrains Mono — counts, code, IDs */
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-500.woff2") format("woff2");
}

/* ============================================================
   Design tokens — Typography Spec v1.0
   Pair with the color palette doc (Option A · Pool).
   ============================================================ */
:root {
    /* Type families */
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
                 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo,
                 Consolas, monospace;

    /* Ink scale — text colors, dark to light */
    --ink:        #0f172a;  /* page titles, primary body */
    --ink-2:      #334155;  /* secondary body */
    --ink-3:      #64748b;  /* meta, dates, labels */
    --ink-4:      #94a3b8;  /* placeholder, disabled */

    /* Accent — brand blue (Pool) */
    --accent:     #1e78c4;  /* section headers, hover, primary buttons */
    --accent-ink: #15507d;  /* default link color, deep accents */
    --accent-soft:#eaf2f8;  /* tints, card backgrounds */

    /* Surfaces */
    --paper:      #ffffff;
    --paper-2:    #f7f8fa;
    --rule:       #e2e6ec;

    /* Status */
    --good:       #047857;
    --warn:       #b45309;
    --bad:        #b91c1c;

    /* Legacy aliases — keep until all component CSS migrates */
    --blue:       var(--accent);
    --gray:       var(--ink-3);
}

/* ============================================================
   Base
   ============================================================ */
html, body {
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ============================================================
   Wordmark — "Swim.team" (the blue dot is the whole identity)
   Markup: Swim<span class="dot">.</span>team
   .wordmark = display/masthead use · .brand = small inline use.
   Scale font-size + letter-spacing per the wordmark ramp; the
   dot stays --accent in every context, including on dark.
   ============================================================ */
.wordmark {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--ink);
}
.brand {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.wordmark .dot,
.brand .dot {
    color: var(--accent);
}

/* ============================================================
   Type ramp — h1 (page) · h2 (section) · h3 (sub) · .h-label
   ============================================================ */
h1, .h-page {
    font-size: 32px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 12px;
}
h2, .h-section {
    font-size: 22px;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--accent-ink);
    margin: 32px 0 12px;
}
h3, .h-sub {
    font-size: 17px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--accent-ink);
    margin: 20px 0 8px;
}
h4 {
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink);
    margin: 16px 0 8px;
}
.h-label {
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 16px 0 8px;
}

p, .body {
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    margin: 0 0 1em;
    text-wrap: pretty;
}
.small, .meta {
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink-3);
}
.date, .editorial {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-3);
}
.mono, code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}
strong, b {
    color: var(--ink);
    font-weight: 600;
}

/* Tabular figures everywhere numbers align */
table, .stats, .tabular {
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Links — default underline, accent-ink, no purple visited
   ============================================================ */
a {
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: currentColor;
    text-underline-offset: 2px;
    transition: color 120ms ease, text-decoration-thickness 120ms ease;
}
a:hover {
    color: var(--accent);
    text-decoration-thickness: 2px;
}
a:visited {
    color: var(--accent-ink);
}
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 1px;
}

/* Heading-as-link — drop underline, take heading color */
h1 a, h2 a, h3 a,
.h-page a, .h-section a, .h-sub a {
    color: inherit;
    text-decoration: none;
}
h1 a:hover, h2 a:hover, h3 a:hover,
.h-page a:hover, .h-section a:hover, .h-sub a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Card-wrapping link — entire card clickable, title underlines on hover */
a.card {
    color: inherit;
    text-decoration: none;
    display: block;
}
a.card:hover .card-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* ============================================================
   Mobile downscale
   ============================================================ */
@media (max-width: 640px) {
    h1, .h-page    { font-size: 26px; }
    h2, .h-section { font-size: 19px; }
    h3, .h-sub     { font-size: 16px; }
    /* p, .body stays 15px */
}

/* ============================================================
   Site components
   ============================================================ */
hr {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid var(--rule);
}
li {
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

/* Color utilities (legacy) */
.blue-color { color: var(--accent); }
.gray-color { color: var(--ink-3); }

/* Layout */
#container {
    width: 610px;
    max-width: 100%;
    margin: auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    font-size: 0.8rem;
    color: var(--ink-3);
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 6px;
    color: var(--ink-3);
}
.breadcrumb-item a {
    color: var(--ink-3);
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--ink-3);
    margin-top: 3rem;
}

/* Images */
.image {
    max-inline-size: 100%;
    block-size: auto;
}

/* Post — date line uses editorial serif italic per spec */
.post-time {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-3);
    margin: 0 0 0.75rem;
}
.post-permalink {
    margin-left: 1rem;
}
.post-title a {
    color: var(--accent-ink);
    font-size: 2rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.02em;
}
.post-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.svg-icon {
    display: inline-block;
    vertical-align: -.125rem;
}
.text-center {
    text-align: center;
}

/* Status messages */
.status-msg {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.status-msg.success {
    background: #e6f4ea;
    color: #1e7e34;
}
.status-msg.error {
    background: #fce8e6;
    color: #c5221f;
}
.status-msg p {
    margin: 0;
    line-height: 1.5;
}
.status-msg p + p {
    margin-top: 0.5rem;
}
.status-msg a {
    color: inherit;
    font-weight: 500;
}

/* Forms */
.form-create-account {
    width: 100%;
    box-sizing: border-box;
    max-width: 400px;
    padding: 1rem;
    border: 1px solid var(--rule);
    border-radius: 0.5rem;
    margin: 0 auto;
}
.form-error {
    color: var(--bad);
    margin-bottom: 1.5rem;
    text-align: center;
}
.form-input, .form-label {
    width: 100%;
    display: block;
}
.form-input {
    border-radius: 0.5rem;
    border: 1px solid var(--rule);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
    font-family: inherit;
    color: var(--ink);
}
.form-label {
    margin-bottom: 0.5rem;
}
.form-submit {
    --button-primary: var(--accent);
    --button-hover: var(--accent-ink);
    background-color: var(--button-primary);
    border: 1px solid var(--button-primary);
    border-color: var(--button-primary);
    border-radius: 0.25rem;
    color: #fff;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s;
    font-family: inherit;
    cursor: pointer;
}
.form-submit:hover {
    background-color: var(--button-hover);
    border: 1px solid var(--button-hover);
    border-color: var(--button-hover);
}

/* Post Description */
.post-description {
    line-height: 1.55;
    margin-bottom: 1rem;
}

/* Post Edit */
.post-edit-details {
    margin-top: 1rem;
}
.post-edit-details summary {
    cursor: pointer;
    color: var(--accent-ink);
    margin-bottom: 1rem;
}
.post-edit-field {
    margin-bottom: 1rem;
}
.post-edit-form {
    margin-top: 1rem;
}
.post-delete-btn {
    --button-primary: var(--bad);
    --button-hover: #8e1616;
    background-color: var(--button-primary);
    border-color: var(--button-primary);
}
.post-delete-btn:hover {
    background-color: var(--button-hover);
    border-color: var(--button-hover);
}
.edit-success {
    color: var(--good);
}

/* Workout Text Display */
.workout-text {
    margin: 1.5rem 0;
    border: 1px solid var(--rule);
    border-radius: 0.5rem;
    padding: 1rem;
}
.workout-text__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.workout-text__header h3 {
    margin: 0;
}
.workout-text__body {
    font-family: inherit;
    white-space: pre-wrap;
    margin: 0;
    line-height: 1.5;
}

/* Approval Badges */
.approval-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-weight: 500;
}
.approval-badge--draft {
    background-color: #E1E1E9;
    color: #555;
}
.approval-badge--review {
    background-color: #FFF3CD;
    color: #856404;
}
.approval-badge--approved {
    background-color: #D4EDDA;
    color: #155724;
}
.approval-count {
    font-size: 0.8rem;
    color: var(--ink-3);
}

/* OCR Button */
.workout-ocr-section {
    margin: 1.5rem 0;
}
.ocr-button {
    background-color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 0.25rem;
    color: #fff;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: opacity .15s ease-in-out;
    font-family: inherit;
}
.ocr-button:hover {
    opacity: 0.85;
}
.ocr-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ocr-status {
    font-size: 0.9rem;
    color: var(--ink-3);
    margin-top: 0.5rem;
}

/* Workout Editor */
.workout-editor {
    margin: 1.5rem 0;
}
.workout-editor summary {
    cursor: pointer;
    color: var(--accent-ink);
    margin-bottom: 1rem;
}
.workout-editor__form {
    margin-top: 1rem;
}
.workout-editor__field {
    margin-bottom: 1rem;
}
.workout-editor__unit-row label {
    margin-right: 1rem;
}
.workout-editor__set {
    border: 1px solid var(--rule);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
.workout-editor__set-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.workout-editor__set-header .form-input {
    margin-bottom: 0;
    flex: 1;
}
.workout-editor__item {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.workout-editor__item .form-input {
    margin-bottom: 0;
    min-width: 0;
}
.workout-editor__item .item-reps {
    width: 60px;
    flex: 0 0 60px;
}
.workout-editor__item .item-distance {
    width: 70px;
    flex: 0 0 70px;
}
.workout-editor__item .item-stroke {
    flex: 1;
}
.workout-editor__item .item-description {
    flex: 1.5;
}
.workout-editor__item .item-interval {
    width: 80px;
    flex: 0 0 80px;
}
.workout-editor__remove-btn {
    background: none;
    border: 1px solid var(--bad);
    color: var(--bad);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    font-family: inherit;
}
.workout-editor__remove-item-btn {
    background: none;
    border: 1px solid var(--bad);
    color: var(--bad);
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    font-size: 0.8rem;
    flex: 0 0 auto;
    font-family: inherit;
}
.workout-editor__add-item-btn {
    background: none;
    border: none;
    color: var(--accent-ink);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    font-family: inherit;
}
.workout-editor__actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.workout-editor__approve-btn {
    --button-primary: var(--good);
    --button-hover: #036046;
    background-color: var(--button-primary);
    border-color: var(--button-primary);
}
.workout-editor__approve-btn:hover {
    background-color: var(--button-hover);
    border-color: var(--button-hover);
}
.workout-editor__status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.workout-editor__status--error {
    color: var(--bad);
}
.workout-editor__status--success {
    color: var(--good);
}

/* Workout Preview in List Views */
.workout-preview {
    font-size: 0.9rem;
    color: var(--ink-2);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--paper-2);
    border-radius: 0.25rem;
}

/* Edit History */
.edit-history {
    margin: 1rem 0;
}
.edit-history summary {
    cursor: pointer;
    color: var(--ink-3);
    font-size: 0.9rem;
}
.edit-history ul {
    font-size: 0.85rem;
    color: var(--ink-2);
    line-height: 1.6;
}
