/* Shared public-side styles (landing, result, stats, 404, login frame).
 * Relies on design tokens from tokens.css. Admin-only rules live in admin.css.
 */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    background: var(--color-bg);
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

code,
.mono {
    font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
 * Skip link (a11y)
 * -------------------------------------------------------------------------- */

.skip-link {
    position: absolute;
    left: var(--sp-3);
    top: -48px;
    padding: var(--sp-2) var(--sp-4);
    background: var(--color-accent);
    color: var(--color-accent-foreground);
    border-radius: var(--radius-md);
    font-weight: 500;
    z-index: var(--z-toast);
    transition: top var(--duration-base) var(--ease-out);
}

.skip-link:focus,
.skip-link:focus-visible {
    top: var(--sp-3);
    text-decoration: none;
    outline: 2px solid var(--color-accent-foreground);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
 * App shell (public pages)
 * -------------------------------------------------------------------------- */

.app-header {
    position: relative;
    padding: var(--sp-5) var(--sp-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.app-header .wrap {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.app-header .brand {
    font-size: var(--text-md);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--color-text);
}

.app-header .brand a {
    color: inherit;
}

.app-header .brand a:hover {
    text-decoration: none;
}

.app-header .spacer {
    flex: 1;
}

.app-header .header-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

main {
    flex: 1;
    padding: var(--sp-7) var(--sp-4);
    background-image: var(--hero-glow);
    background-repeat: no-repeat;
    background-position: top center;
}

main .wrap {
    max-width: 960px;
    margin: 0 auto;
}

footer.app-footer {
    padding: var(--sp-4);
    text-align: center;
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-3);
    font-size: var(--text-xs);
}

.footer-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
    color: var(--color-accent);
    text-decoration: underline;
}

.footer-meta {
    color: var(--color-text-subtle);
}

/* --------------------------------------------------------------------------
 * Panels, cards, surfaces
 * -------------------------------------------------------------------------- */

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
    /* Long URLs (Short/Target links, Top-links rows, user agents, referers)
     * are unbreakable tokens. Without a wrap hint they inflate the panel's
     * min-content width past the viewport on mobile, pushing the whole
     * admin column off-screen. min-width: 0 lets the panel shrink inside
     * flex/grid parents, overflow-wrap: anywhere breaks the URL token. */
    min-width: 0;
    overflow-wrap: anywhere;
}

.panel + .panel,
.panel + .panel-grid-2,
.panel-grid-2 + .panel,
.panel-grid-2 + .panel-grid-2,
.kpi-grid + .panel,
.kpi-grid + .panel-grid-2 {
    margin-top: var(--sp-5);
}

.panel-title {
    margin: 0 0 var(--sp-4);
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.panel-title .meta {
    font-weight: 400;
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

h1,
h2,
h3 {
    letter-spacing: var(--tracking-tight);
}

h2 {
    margin-top: 0;
    font-size: var(--text-2xl);
}

/* --------------------------------------------------------------------------
 * Form controls
 * -------------------------------------------------------------------------- */

label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--color-field);
    border: 1px solid var(--color-field-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--text-base);
    font-family: inherit;
    transition: border-color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-ring);
}

input::placeholder {
    color: var(--color-text-subtle);
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px 16px;
    background: var(--color-accent);
    color: var(--color-accent-foreground);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    transition: background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}

button:hover,
.btn:hover {
    background: var(--color-accent-hover);
    color: var(--color-accent-foreground);
    text-decoration: none;
}

button:active,
.btn:active {
    transform: translateY(1px);
}

.btn.secondary,
button.secondary {
    background: transparent;
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn.secondary:hover,
button.secondary:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn.ghost,
button.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-muted);
    padding: 8px 12px;
}

.btn.ghost:hover,
button.ghost:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.btn.danger,
button.danger {
    background: var(--color-danger);
    color: #ffffff;
    border-color: transparent;
}

.btn.danger:hover,
button.danger:hover {
    background: var(--color-danger);
    filter: brightness(0.92);
    color: #ffffff;
}

.btn.sm,
button.sm {
    padding: 6px 10px;
    font-size: var(--text-sm);
}

.btn.icon-only,
button.icon-only {
    padding: 8px;
}

/* Focus-visible outlines — consistent across all interactive elements. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

.form-row {
    margin-bottom: var(--sp-4);
}

.form-error {
    color: var(--color-danger);
    font-size: var(--text-sm);
    margin-top: var(--sp-2);
}

/* Symfony's form_errors() renders a <ul><li>…</li></ul>. With a single error
 * the default disc bullet reads like noise, so strip the marker and indent. */
.form-error ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* --------------------------------------------------------------------------
 * Hero / landing
 * -------------------------------------------------------------------------- */

.hero {
    text-align: center;
    padding: var(--sp-9) 0 var(--sp-8);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: var(--sp-5);
}

.hero h1 {
    margin: 0 0 var(--sp-4);
    font-size: var(--text-4xl);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.hero-subtitle {
    max-width: 540px;
    margin: 0 auto var(--sp-7);
    color: var(--color-text-muted);
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
}

.hero-form {
    max-width: 640px;
    margin: 0 auto;
}

.hero-form .input-row {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    /* When the button wraps to its own line on narrow viewports the default
     * flex-start would pin it to the left. Centering keeps the wrapped CTA
     * visually anchored to the hero column. */
    justify-content: center;
}

.hero-form .input-row input {
    flex: 1 1 320px;
    min-width: 0;
    height: 56px;
    font-size: var(--text-md);
    padding: 0 16px;
    box-shadow: var(--shadow-md);
}

.hero-form .input-row button {
    height: 56px;
    padding: 0 24px;
    font-size: var(--text-md);
    box-shadow: var(--shadow-md);
    /* Full-width CTA on mobile — matches the modern mobile form pattern and
     * avoids the button looking orphaned under a full-width input. */
    width: 100%;
}

/* 560px is where the 320px-basis input + gap + natural button width stop
 * fighting for the same row and settle into a single line. */
@media (min-width: 560px) {
    .hero-form .input-row button {
        width: auto;
    }
}

.hero-note {
    margin-top: var(--sp-3);
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

/* Cloudflare Turnstile widget container. `data-appearance="interaction-only"`
   keeps the slot empty whenever Cloudflare clears the visitor without an
   interactive challenge — but we still need the symmetrical vertical
   spacing the rest of the form uses, otherwise the rare visible variant
   sticks to the surrounding text and the empty variant collapses zero-height
   between two `--sp-3` neighbours, which looks like a layout bug. */
.cf-turnstile {
    margin-top: var(--sp-3);
}

.cf-turnstile:empty {
    margin-top: 0;
}

.alias-row {
    margin-top: var(--sp-3);
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--sp-2);
    row-gap: var(--sp-1);
    align-items: center;
}

.alias-label {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.alias-row input {
    height: 40px;
    padding: 0 12px;
    font-size: var(--text-sm);
    min-width: 0;
    width: 100%;
}

.alias-help {
    grid-column: 1 / -1;
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
 * Feature cards (landing)
 * -------------------------------------------------------------------------- */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-8);
}

/* Wrapper that pairs the .feature-grid with a visible H2. The grid used to
 * live directly under the hero (H1) with only an aria-label, which made
 * the heading hierarchy skip from H1 straight to the feature-card H3s.
 * Bing/Lighthouse flag that as a skipped heading; the visible H2 fixes it.
 * Existing `.faq-section .section-title` and `.how-it-works .section-title`
 * keep their per-section rules; this block is the same shape so all three
 * section headings render identically.
 *
 * Note: sp-7 not sp-9 — unlike .faq-section / .how-it-works (which sit
 * BELOW a feature-grid whose bottom card edge butts up close to the next
 * heading and so wants the largest break), this wrapper sits BELOW the
 * hero, which already adds sp-8 of its own bottom padding. Stacking sp-9
 * on top of that produced a ~96px void above "Why Shrtr" / "What you get"
 * etc. sp-7 keeps the section clearly delimited without the dead space. */
.features-section {
    margin-top: var(--sp-7);
}

.features-section .section-title {
    margin: 0 0 var(--sp-5);
    font-size: var(--text-xl);
    font-weight: 600;
}

.features-section .feature-grid {
    /* Avoid double top-margin: the wrapper already spaces us from the hero. */
    margin-top: 0;
}

/* Cards keep the icon inline with the title on a single baseline instead of
 * stacking icon-above-title. The icon-above pattern oversized the visual
 * hierarchy (a 36px badge dominates a 16px title) and wasted vertical space
 * on mobile where each card became three stacked rows. The flat treatment
 * keeps the accent tint via the badge background; the 28px pill is large
 * enough to feel deliberate without dwarfing the title. */
.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
}

.feature-card h3 {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: 0 0 var(--sp-2);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.feature-card .icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    flex-shrink: 0;
}

.feature-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------------
 * Result page (short-URL, QR) — two-column grid
 * -------------------------------------------------------------------------- */

.result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-6);
    align-items: start;
}

@media (min-width: 768px) {
    .result-grid {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

.short-url {
    display: flex;
    gap: var(--sp-2);
    align-items: stretch;
    margin-bottom: var(--sp-3);
}

.short-url input {
    flex: 1;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: var(--font-mono);
}

.original-url {
    margin-top: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    word-break: break-all;
}

.original-url .label {
    display: block;
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: 4px;
}

.qr-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
}

.qr-card img {
    max-width: 100%;
    width: 240px;
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: var(--sp-2);
}

.qr-card .actions {
    width: 100%;
    display: flex;
    gap: var(--sp-2);
}

.qr-card .actions .btn {
    flex: 1;
}

.actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.copied {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-success);
    font-size: var(--text-xs);
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.copied.shown {
    opacity: 1;
}

/* --------------------------------------------------------------------------
 * KPI cards (shared with admin)
 * -------------------------------------------------------------------------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}

.kpi {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5);
    position: relative;
    overflow: hidden;
}

.kpi .label {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    font-weight: 600;
}

.kpi .value {
    font-size: var(--text-3xl);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    margin-top: var(--sp-1);
    line-height: 1.1;
}

.kpi .value.sub {
    font-size: var(--text-md);
    font-weight: 500;
}

.kpi .sparkline {
    position: absolute;
    right: var(--sp-4);
    bottom: var(--sp-4);
    width: 72px;
    height: 24px;
    color: var(--color-accent);
    pointer-events: none;
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
 * Definition list (meta)
 * -------------------------------------------------------------------------- */

.meta {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.meta dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--sp-2) var(--sp-4);
    margin: 0;
}

.meta dt {
    font-weight: 600;
    color: var(--color-text);
}

.meta dd {
    margin: 0;
}

/* --------------------------------------------------------------------------
 * Badges
 * -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    line-height: 1.4;
}

.badge.ok {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.badge.off {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.badge.warn {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.badge.neutral {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
 * Flashes
 * -------------------------------------------------------------------------- */

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-4);
    font-size: var(--text-sm);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.flash.success {
    background: var(--color-success-soft);
    color: var(--color-success);
    border-color: var(--color-success-soft);
}

.flash.error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border-color: var(--color-danger-soft);
}

/* --------------------------------------------------------------------------
 * Theme segmented control
 * -------------------------------------------------------------------------- */

.theme-toggle {
    display: inline-flex;
    padding: 2px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    gap: 2px;
    margin: 0;
}

.theme-toggle button {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 6px 10px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background var(--duration-fast) var(--ease-out),
        color var(--duration-fast) var(--ease-out);
}

.theme-toggle button:hover {
    color: var(--color-text);
    background: transparent;
}

.theme-toggle button[aria-pressed="true"] {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.theme-toggle .label-text {
    display: none;
}

@media (min-width: 640px) {
    .theme-toggle .label-text {
        display: inline;
    }
}

/* --------------------------------------------------------------------------
 * 404/410 empty states
 * -------------------------------------------------------------------------- */

.empty-card {
    text-align: center;
    max-width: 480px;
    margin: var(--sp-8) auto;
    padding: var(--sp-8) var(--sp-6);
}

.empty-card .glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-pill);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    margin-bottom: var(--sp-4);
}

.empty-card h2 {
    margin: 0 0 var(--sp-2);
    font-size: var(--text-2xl);
}

.empty-card p {
    color: var(--color-text-muted);
    margin: 0 0 var(--sp-5);
}

/* --------------------------------------------------------------------------
 * Generic utilities
 * -------------------------------------------------------------------------- */

.truncate {
    /* Fill the containing cell/card and ellipsise what doesn't fit.
     * The old 320px cap was inherited from a narrower layout era and
     * left the Original URL column visibly half-empty on the admin
     * Links table whenever the viewport was wider than ~1200px.
     * Table-sibling columns already carry `white-space: nowrap`, so
     * the URL column naturally takes the remaining track width — no
     * risk of it squashing adjacent data. On narrow/mobile flex rows
     * (admin.css mobile media query) a local override still pins
     * `.truncate` to `max-width: 100%; min-width: 0; flex: 1 1 0`,
     * so removing the absolute cap here doesn't regress phone layout. */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.icon {
    flex-shrink: 0;
    vertical-align: middle;
}

.muted {
    color: var(--color-text-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
 * QR customiser (result page advanced panel)
 * -------------------------------------------------------------------------- */

.qr-customiser {
    margin-top: var(--sp-5);
    border-top: 1px solid var(--color-border);
    padding-top: var(--sp-4);
}

.qr-customiser > summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    list-style: none;
}

.qr-customiser > summary::-webkit-details-marker {
    display: none;
}

.qr-customiser > summary::before {
    content: '▶';
    font-size: 10px;
    transition: transform 0.15s ease;
}

.qr-customiser[open] > summary::before {
    transform: rotate(90deg);
}

.qr-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-3);
    margin-top: var(--sp-3);
}

.qr-field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.qr-field label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 600;
}

.qr-field input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.qr-field input[type="range"] {
    width: 100%;
}

.qr-field select {
    height: 36px;
    padding: 0 var(--sp-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--text-sm);
}

.qr-field-actions {
    justify-content: flex-end;
    align-self: flex-end;
}

/* --------------------------------------------------------------------------
 * API docs (templates/docs/api.html.twig)
 * -------------------------------------------------------------------------- */

.api-section {
    margin-top: var(--sp-7);
}

.api-section h2 {
    margin: 0 0 var(--sp-3);
    font-size: var(--text-xl);
    font-weight: 600;
}

.api-section h3 {
    margin: var(--sp-4) 0 var(--sp-2);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-text-muted);
}

.code-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin: 0;
}

.api-section code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95em;
}

.endpoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-3);
}

.endpoint {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.method {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.method-get {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.method-post {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.endpoint p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--sp-3) 0;
    font-size: var(--text-sm);
}

.api-table th,
.api-table td {
    text-align: left;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--color-border);
}

.api-table th {
    color: var(--color-text-muted);
    font-weight: 600;
}

/* UTM link builder ----------------------------------------------------- */

.utm-panel {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.utm-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3) var(--sp-4);
}

.utm-field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    min-width: 0;
}

.utm-field-wide {
    grid-column: 1 / -1;
}

.utm-field label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.utm-field small {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

.utm-field code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95em;
    background: var(--color-surface-strong, var(--color-surface));
    padding: 0 4px;
    border-radius: var(--radius-sm);
}

.utm-field input {
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.utm-field input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.utm-required {
    color: var(--color-danger, #c62828);
    margin-left: 2px;
}

.utm-optional {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: var(--text-xs);
}

.utm-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.utm-result {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.utm-result label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.utm-shorten-link {
    align-self: flex-start;
}

@media (max-width: 640px) {
    .utm-form {
        grid-template-columns: 1fr;
    }
    .utm-field-wide {
        grid-column: auto;
    }
}

/* --------------------------------------------------------------------------
 * Landing FAQ — visible Q&A list mirrored from the FAQPage JSON-LD.
 *
 * Google's FAQPage policy (developers.google.com/search/docs/appearance/
 * structured-data/faqpage) requires the marked-up Q&A to be visible to
 * users on the page. Hidden FAQ markup is treated as a guideline violation
 * and downranks/penalises the page. Native `<details>/<summary>` gives us
 * the accordion behaviour, accessibility, and keyboard support for free —
 * no JS, no ARIA gymnastics.
 * -------------------------------------------------------------------------- */

.faq-section {
    margin-top: var(--sp-9);
}

.faq-section .section-title {
    margin: 0 0 var(--sp-5);
    font-size: var(--text-xl);
    font-weight: 600;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5);
}

.faq-item > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--text-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    list-style: none;
}

.faq-item > summary::-webkit-details-marker {
    display: none;
}

.faq-item > summary::after {
    content: '+';
    font-size: var(--text-xl);
    font-weight: 400;
    color: var(--color-text-muted);
    transition: transform 0.15s ease;
    line-height: 1;
}

.faq-item[open] > summary::after {
    transform: rotate(45deg);
}

.faq-item > p {
    margin: var(--sp-3) 0 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------------
 * "How it works" — three-step explainer, used on /free-url-shortener to add
 * unique visible content that's not present on the home page (the primary
 * dedup signal Google uses to merge near-identical landings).
 * -------------------------------------------------------------------------- */

.how-it-works {
    margin-top: var(--sp-9);
}

.how-it-works .section-title {
    margin: 0 0 var(--sp-5);
    font-size: var(--text-xl);
    font-weight: 600;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
}

/* Mirrors the .feature-card inline-icon pattern — the step number sits on
 * the same baseline as the heading so the grid reads as three balanced
 * rows of "1 Title / copy" rather than icon-above-title stacks. */
.step-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
}

.step-card h3 {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: 0 0 var(--sp-2);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.step-card .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 700;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.step-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

