/* ---------------------------------------------------------------------------
   Practice Room — shared theme for every page on practice-room.org.
   Linked by index.php, privacy.php, policy.php and support.php.

   Colour: Material Design 3 role tokens, generated with material-color-utilities
   (Fidelity scheme) from the source colour #4A90E2. Fidelity is used rather than
   the default Tonal Spot because it keeps the brand blue recognisable.
   Do not hand-pick colours here — regenerate from the seed instead.

   Type: one body size for the whole site. Do not add Tailwind text-* classes to
   body copy; Tailwind's text-lg also sets line-height and would override this.
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   DESIGN TOKENS — the whole visual system in one place.

   Type and spacing are in rem so they scale with the reader's browser font.
   Image sizes are in px, because a picture has a physical size you judge by eye.
   Nothing in the page templates should use a raw value; use a token.
   --------------------------------------------------------------------------- */
:root {
    /* Type scale (rem) */
    --text-display:  2.25rem;   /* page headline, 36px  */
    --text-headline: 1.5rem;    /* section heading, 24px */
    --text-title:    1.25rem;   /* sub-heading, 20px */
    --text-body:     1.0625rem; /* body copy, 17px */
    --text-label:    0.9375rem; /* captions, nav, pills, 15px */
    --text-fine:     0.8125rem; /* bibliography and fine print, 13px */

    --line-body:     1.6;
    --line-tight:    1.25;
    --measure:       34rem;

    /* Spacing scale (rem) */
    --space-1: 0.5rem;
    --space-2: 0.75rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --space-7: 3.5rem;

    /* Shape */
    --radius-lg: 28px;
    --radius-sm: 12px;

    /* Image sizes (px — judged by eye, not by font size) */
    --photo-max:      1000px;   /* undefined photographs stretch to this */
    --photo-small:     380px;
    --photo-wide:      900px;
    --shot-max:        370px;   /* a screenshot at its normal size */
    --shot-small:      250px;
}

:root {
    /* DARK (default) */
    --md-primary:                   #A4C9FF;
    --md-on-primary:                #00315D;
    --md-primary-container:         #4D93E5;
    --md-on-primary-container:      #00274C;
    --md-surface:                   #101418;
    --md-on-surface:                #E1E2E9;
    --md-on-surface-variant:        #C1C7D3;
    --md-surface-container-low:     #191C21;
    --md-surface-container:         #1D2025;
    --md-surface-container-high:    #272A2F;
    --md-surface-container-highest: #32353A;
    --md-outline:                   #8B919D;
    --md-outline-variant:           #414751;
    --md-secondary-container:       #314867;
    --md-on-secondary-container:    #9FB7DB;
    --md-tertiary-container:        #C58305;
    --md-on-tertiary-container:     #392200;

}

/* LIGHT */
body[data-theme="light"] {
    --md-primary:                   #005DA7;
    --md-on-primary:                #FFFFFF;
    --md-primary-container:         #2976C7;
    --md-on-primary-container:      #FDFCFF;
    --md-surface:                   #F8F9FF;
    --md-on-surface:                #191C21;
    --md-on-surface-variant:        #414751;
    --md-surface-container-low:     #F2F3FB;
    --md-surface-container:         #ECEDF5;
    --md-surface-container-high:    #E6E8EF;
    --md-surface-container-highest: #E1E2E9;
    --md-outline:                   #717783;
    --md-outline-variant:           #C1C7D3;
    --md-secondary-container:       #C1D9FE;
    --md-on-secondary-container:    #485E7E;
    --md-tertiary-container:        #A06900;
    --md-on-tertiary-container:     #FFFBFF;
}

/* Role assignments. Page sits on a container tone; cards sit one step apart,
   which is how MD3 separates a surface from its background. */
:root, body[data-theme="light"] {
    --bg-page:        var(--md-surface-container);
    --bg-card:        var(--md-surface-container-low);
    --nav-bg:         var(--md-surface-container);
    --text-primary:   var(--md-on-surface);
    --text-secondary: var(--md-on-surface-variant);
    --accent-color:   var(--md-primary);
    --border-color:   var(--md-outline-variant);  /* dividers */
    --card-outline:   var(--md-outline);          /* card edge */
    --placeholder-bg: var(--md-surface-container-high);
}
body[data-theme="light"] {
    /* In light mode the card is the lightest tone, the page a step down. */
    --bg-card: #FFFFFF;   /* surfaceContainerLowest */
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* The single body-copy style, used on every page. */
.copy {
    max-width: var(--measure);
    font-size: var(--text-body);
    line-height: var(--line-body);
    color: var(--text-secondary);
    margin-bottom: 1.15rem;
}
.copy:last-child { margin-bottom: 0; }

.bento-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-outline);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-sticky {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--nav-bg);
    border-bottom: none;
    transition: background-color 0.3s ease;
}

.btn-icon {
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.btn-icon:hover {
    background-color: var(--bg-card);
    color: var(--accent-color);
    border-color: var(--border-color);
}

.screenshot img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}
.screenshot figcaption {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 10px;
}

.screenshot-placeholder {
    background-color: var(--placeholder-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-height: 280px;
    width: 100%;
}

/* Status table */
.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-body);
}
.status-row:last-child { border-bottom: none; }
.status-name {
    font-weight: 600;
    min-width: 14rem;
    color: var(--text-primary);
}
.status-note {
    color: var(--text-secondary);
    flex: 1 1 18rem;
}
.pill {
    display: inline-block;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 8px 20px;
    border-radius: 999px;
}
/* Status pills use MD3 container roles rather than invented colours. */
.pill-active  { background: var(--md-primary-container);         color: var(--md-on-primary-container); }
.pill-soon    { background: var(--md-secondary-container);       color: var(--md-on-secondary-container); }
.pill-planned { background: var(--md-surface-container-highest); color: var(--md-on-surface-variant); }

a.text-link { color: var(--accent-color); }
a.text-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Legal pages (privacy, terms, support). The content comes from *_content.txt
   as raw HTML, so it is styled by element rather than by class. It uses exactly
   the same size and rhythm as .copy — no separate mobile/desktop sizes.
   --------------------------------------------------------------------------- */
body .legal-content h3 {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.25;
}
body .legal-content h3:first-child { margin-top: 0; }

body .legal-content p {
    display: block;
    max-width: var(--measure);
    font-size: var(--text-body);
    line-height: var(--line-body);
    color: var(--text-secondary);
    margin-bottom: 1.15rem;
}

body .legal-content b,
body .legal-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* Phone screenshots are tall (roughly 1:2.2), so cap them by HEIGHT, not width.
   Capping the width made them 600px+ tall and they filled a desktop screen.
   These heights keep them at about the size of a real phone, or smaller. */
.screenshot.phone .shot-frame { max-width: var(--shot-max); }
.screenshot.phone.compact .shot-frame,
.screenshot.phone.small .shot-frame { max-width: var(--shot-small); }
.screenshot.phone img {
    width: 100%;
    height: auto;
    display: block;
}
/* The caption belongs to the figure, not to the narrow image column, so it must
   not inherit the image width or it wraps one word per line. */
.screenshot figcaption {
    max-width: var(--measure);
    text-align: left;
}

/* Numbered steps in the user manual */
.manual-steps {
    list-style: decimal;
    padding-left: 1.4rem;
    margin-top: 0.9rem;
    max-width: var(--measure);
}
.manual-steps li {
    font-size: var(--text-body);
    line-height: var(--line-body);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Navigation link (Manual / Home) */
.nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-link:hover {
    color: var(--accent-color);
    background-color: var(--bg-card);
}

/* Manual table of contents */
.manual-toc {
    list-style: decimal;
    padding-left: 1.4rem;
}
.manual-toc li {
    font-size: var(--text-body);
    line-height: var(--line-body);
    margin-bottom: 0.4rem;
}

/* ---------------------------------------------------------------------------
   Markdown-rendered content. The page templates wrap each rendered block in
   .copy-block, so plain Markdown produces exactly the same type as .copy.
   --------------------------------------------------------------------------- */
.copy-block > p,
.copy-block > ul li,
.copy-block > ol li {
    max-width: var(--measure);
    font-size: var(--text-body);
    line-height: var(--line-body);
    color: var(--text-secondary);
}
.copy-block > p { margin-bottom: 1.15rem; }
.copy-block > p:last-child { margin-bottom: 0; }
.copy-block > ul,
.copy-block > ol {
    padding-left: 1.4rem;
    margin: 0.6rem 0 1.15rem;
}
.copy-block > ul { list-style: disc; }
.copy-block > ol { list-style: decimal; }
.copy-block > ul li,
.copy-block > ol li { margin-bottom: 0.5rem; }
.copy-block a { color: var(--accent-color); }
.copy-block a:hover { text-decoration: underline; }
.copy-block strong { color: var(--text-primary); font-weight: 600; }

/* The status groups are Markdown tables; render them as the row list they are. */
.status-table table {
    width: 100%;
    border-collapse: collapse;
}
.status-table thead { display: none; }
.status-table td {
    padding: 14px 16px 14px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-body);
    line-height: var(--line-body);
    color: var(--text-secondary);
    vertical-align: top;
}
.status-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    width: 15rem;
}
.status-table tr:last-child td { border-bottom: none; }

@media (max-width: 640px) {
    .status-table td { display: block; border-bottom: none; padding: 2px 0; }
    .status-table td:first-child { width: auto; padding-top: 12px; }
    .status-table tr { display: block; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
    .status-table tr:last-child { border-bottom: none; }
}

/* ---------------------------------------------------------------------------
   Photographs. Full width on a phone, capped on desktop — a 3:2 photo at the
   full 1152px container is over 700px tall and fills a laptop screen.
   Change --photo-max to resize every photograph on the site.
   --------------------------------------------------------------------------- */

.photo {
    max-width: var(--photo-max);
    margin: 0 0 var(--space-5);
}
.photo img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-outline);
}

/* Per-image size classes, set in Markdown with Pandoc attribute syntax:
     ![alt](file.webp){.small}     ![alt](file.webp){width=420}
   The default is deliberately modest; make an image big only where it earns it. */
.photo.small { max-width: var(--photo-small); }
.photo.wide  { max-width: var(--photo-wide); }
.photo.full  { max-width: 100%; }


/* ---------------------------------------------------------------------------
   Numbered callouts on screenshots.
   Set in Markdown with  {marks="24,43 50,43"}  — percentages of the image.
   The numbers are drawn over the picture, so they scale with it, the labels
   stay translatable in the Markdown, and replacing a screenshot does not mean
   redrawing artwork.
   --------------------------------------------------------------------------- */
.shot-frame {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.shot-frame .mark {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;          /* the UI underneath stays visible */
    border: 1.5px solid #FFFFFF;
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    /* a soft dark halo so a white ring stays readable on light UI too */
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 4px rgba(0, 0, 0, 0.6);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

/* The numbered list under an annotated screenshot, matching the callouts. */
.copy-block > ol.marks-legend { list-style: none; padding-left: 0; }
.copy-block > ol.marks-legend li { counter-increment: mk; position: relative; padding-left: 2.2rem; }
.copy-block > ol.marks-legend li::before {
    content: counter(mk);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--md-on-surface);
    color: var(--md-surface);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}
.copy-block > ol.marks-legend { counter-reset: mk; }

/* Footer — left aligned, like every other block on the page. */
.site-footer {
    padding: var(--space-6) 0 var(--space-5);
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-6);
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin-bottom: var(--space-3);
}
.footer-links a {
    color: var(--text-secondary);
    font-size: var(--text-label);
    transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent-color); }
.footer-fine {
    color: var(--text-secondary);
    font-size: var(--text-fine);
    opacity: 0.75;
    margin-bottom: 0.25rem;
}

/* Bibliography — a fine-print block at the end of the page. */
.bibliography .copy-block > ul { list-style: none; padding-left: 0; }
.bibliography .copy-block > ul li {
    font-size: var(--text-fine);
    line-height: 1.5;
    max-width: 52rem;
    margin-bottom: var(--space-1);
    padding-left: 1.2rem;
    text-indent: -1.2rem;
}
.bibliography h2 { font-size: var(--text-title) !important; }

/* ---------------------------------------------------------------------------
   Media row — the recurring "text on one side, phone screenshot on the other"
   component. Used on the landing page and in the manual.

   A two-column row rather than text flowing around the image: a phone
   screenshot is roughly 1:2.2, so wrapping text around it leaves a long ragged
   channel beside a very tall picture, and floats collapse unpredictably on
   small screens. Two columns stack cleanly instead.
   --------------------------------------------------------------------------- */
.media-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    align-items: flex-start;
    /* The row is exactly as wide as its contents. Left at full container width
       it leaves a dead channel between the text measure and the picture. */
    max-width: calc(var(--measure) + var(--shot-max) + var(--space-5));
}
.media-row-text { flex: 1 1 0; min-width: 0; }
.media-row-shot { flex: 0 0 auto; }

@media (min-width: 768px) {
    /* top aligned, not centred: the heading lines up with the top of the
       screenshot instead of floating in the middle of a very tall picture */
    .media-row { flex-direction: row; gap: var(--space-5); align-items: flex-start; }
    .media-row.is-reversed { flex-direction: row-reverse; }
    .media-row-shot { width: var(--shot-max); }
}

/* Three short features read as one group, not a stack with a stray picture. */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}
@media (min-width: 768px) {
    .feature-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
}
.feature-item .copy-block > p { max-width: none; }
.feature-title {
    font-size: var(--text-title);
    font-weight: 700;
    line-height: var(--line-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

/* One screenshot, presented deliberately rather than tacked onto a column. */
.showcase {
    margin-top: var(--space-6);
    padding: var(--space-5) var(--space-4);
    background: var(--md-surface-container-high);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
}
.showcase .screenshot { margin: 0; }
.showcase figcaption { text-align: center; max-width: 28rem; }

/* Navigation actions: equal-width buttons so their edges line up between
   pages, and bottom-aligned with the logo text rather than floating centred. */
.nav-actions {
    display: flex;
    align-items: flex-end;
    gap: var(--space-1);
    padding-bottom: 2px;
}
.nav-link {
    min-width: 6.5rem;
    text-align: center;
}
.nav-lang {
    min-width: 3.25rem;
    opacity: 0.55;
    cursor: default;
}

/* Internal image index (images.php) */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-4);
}
.image-card { margin: 0; }
.image-card img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--md-surface-container-high);
}
.image-card figcaption {
    font-size: var(--text-fine);
    color: var(--text-secondary);
    line-height: 1.35;
    margin-top: var(--space-1);
    word-break: break-all;
}
.image-card strong { color: var(--text-primary); font-weight: 600; }

/* A cropped detail of a screen. Wide, so it matches the height of a short
   paragraph beside it — unlike a whole phone screen, which is 1:2.2 and can
   never balance three or four lines of text. */
.screenshot.detail .shot-frame { max-width: 100%; }
.screenshot.detail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}
.media-row-shot.is-detail { width: 100%; max-width: 26rem; }
@media (min-width: 768px) {
    .media-row-shot.is-detail { flex: 0 1 26rem; }
}

.page-date {
    font-size: var(--text-label);
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* Navigation on small screens: the buttons move to their own row at the very
   top, so they can never sit over the logo or the tagline beside it. */
/* The logo always comes first and stays on the left. If the row is too narrow
   the actions wrap to a second line beneath it — the logo never moves. */
.nav-sticky { flex-wrap: wrap; row-gap: var(--space-2); }
.nav-actions { margin-left: auto; }

@media (max-width: 639px) {
    /* On a phone the actions are plain text links, not buttons: at this width a
       bordered pill is too heavy and pushes the row into a second line. */
    .nav-actions { gap: var(--space-3); padding-bottom: 0; }
    .nav-link {
        min-width: 0;
        padding: 0;
        border: none;
        font-size: var(--text-label);
        text-decoration: underline;
        text-underline-offset: 3px;
    }
    .nav-link:hover { background: none; }
    .nav-lang { text-decoration: none; }
    .nav-sticky .h-12 { height: 2.25rem; }        /* smaller logo mark */
    .nav-sticky .text-xl { font-size: 1.0625rem; } /* smaller wordmark */
    .nav-sticky .text-sm { font-size: 0.8125rem; }
}

/* Below ~420px the tagline alone is 178px wide and forces the menu onto a
   second line. The wordmark still says who we are, so the tagline steps aside
   and logo + name + menu fit on one row. */
@media (max-width: 420px) {
    .nav-sticky .text-sm { display: none; }
    .nav-actions { gap: var(--space-2); }
}

/* ---------------------------------------------------------------------------
   Line breaking.
   text-wrap: pretty asks the browser to avoid a last line with a single short
   word (a widow, or runt). It costs nothing: browsers that do not support it
   ignore the declaration and wrap as before.
   text-wrap: balance evens out the lines of a short heading instead of leaving
   one word stranded on line two.
   --------------------------------------------------------------------------- */
.copy,
.copy-block > p,
.copy-block > ul li,
.copy-block > ol li,
.manual-steps li,
.status-note,
.footer-fine {
    text-wrap: pretty;
}

h1, h2, h3,
.feature-title,
.screenshot figcaption {
    text-wrap: balance;
}

/* Footer email: the mailto link plus the address as plain selectable text, in
   case no mail program is registered for mailto: on the visitor's device. */
.footer-mail {
    font-size: var(--text-label);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}
.footer-mail a { color: var(--accent-color); }
.footer-mail a:hover { text-decoration: underline; }
.footer-mail-plain {
    display: none;
    user-select: all;
}
/* Shown only when the pointer is a touch device or the link is unusable is not
   detectable in CSS, so the plain address simply sits beside the link on wide
   screens where there is room for it. */
@media (min-width: 640px) {
    .footer-mail-plain {
        display: inline;
        margin-left: var(--space-2);
        opacity: 0.6;
    }
    .footer-mail-plain::before { content: "("; }
    .footer-mail-plain::after  { content: ")"; }
}

/* The intellectual-property notice: smaller and quieter than the copyright
   line above it, but still readable. */
.footer-notice {
    font-size: var(--text-fine);
    line-height: 1.5;
    color: var(--text-secondary);
    opacity: 0.7;
    max-width: 60rem;
    margin: var(--space-2) 0;
    text-wrap: pretty;
}

/* A revision line under a document's effective date: quieter than the date
   itself, because the agreement began then and was only revised later. */
.page-updated {
    margin-top: 0.15rem;
    font-size: var(--text-fine);
    opacity: 0.8;
}

/* The logo block is the way home from every page. */
.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-sm);
    transition: opacity 0.2s;
}
.nav-brand:hover { opacity: 0.75; }
.nav-brand[aria-current="page"] { cursor: default; }
.nav-brand[aria-current="page"]:hover { opacity: 1; }
