/*
 * teks.page: the same look as the app. System fonts, serif titles, a thin
 * band in each subject's color, small-caps strand labels, and quiet
 * captions. Light and dark follow the reader's system setting.
 */

:root {
    --bg: #ffffff;
    --bg-grouped: #f2f2f7;
    --card: #ffffff;
    --text: #000000;
    --secondary: #6c6c70;
    --tertiary: #aeaeb2;
    --separator: #e5e5ea;
    --accent: #ff3b30;
    --red: #ff3b30;
    --yellow: #ffcc00;
    --green: #34c759;
    --blue: #007aff;
    --page: var(--accent);
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 20px;
    --margin: 15px;
    --serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
    --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --bg-grouped: #000000;
        --card: #1c1c1e;
        --text: #ffffff;
        --secondary: #98989f;
        --tertiary: #636366;
        --separator: #38383a;
        --accent: #ff453a;
        --red: #ff453a;
        --yellow: #ffd60a;
        --green: #30d158;
        --blue: #0a84ff;
    }
}

.color-red { --page: var(--red); }
.color-yellow { --page: var(--yellow); }
.color-green { --page: var(--green); }
.color-blue { --page: var(--blue); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.45 var(--sans);
}

a { color: inherit; }

.wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 var(--margin);
}

/* Top bar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--separator);
}

.topbar .wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font: 600 20px var(--serif);
    margin-right: auto;
}

.brand img {
    width: 32px;
    height: 32px;
    border-radius: 7px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text);
}

.icon-link:hover { background: var(--bg-grouped); }

.icon-link svg { width: 20px; height: 20px; }

.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover { filter: brightness(1.08); }

/* Page header */

.crumbs {
    margin: 18px 0 0;
    font-size: 14px;
    color: var(--secondary);
}

.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 6px; color: var(--tertiary); }

.title-header { margin: 6px 0 10px; }

.title-header .subject {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--secondary);
}

.title-header h1 {
    margin: 2px 0 0;
    font: 600 clamp(30px, 6vw, 40px)/1.15 var(--serif);
}

.band {
    height: 4px;
    margin-top: 10px;
    border-radius: 2px;
    background: var(--page);
    opacity: 0.8;
}

.caption {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 10px;
    font-size: 13px;
    color: var(--secondary);
}

.caption svg { width: 14px; height: 14px; flex: none; }

/* Strand labels */

.strand {
    margin: 26px 0 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid color-mix(in srgb, var(--page) 30%, transparent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--page) 70%, var(--text));
}

/* Sections */

details.section {
    border-radius: var(--radius-small);
}

details.section > summary {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
    list-style: none;
}

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

details.section > summary .title { flex: 1; }

details.section > summary .chevron {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: var(--page);
    transition: transform 0.25s ease;
}

details.section[open] > summary .chevron { transform: rotate(180deg); }

details.section > summary:focus-visible {
    outline: 2px solid var(--page);
    outline-offset: 2px;
}

.lines {
    margin: 0 0 8px;
    padding: 0 10px;
}

.lines p,
p.standard {
    margin: 0 0 10px;
}

.lines .sub { padding-left: 28px; }

p.standard { padding: 12px 0 2px; }

/* The standard a link or search result opened to. */
:target,
.lines p.target {
    animation: glow 2.2s ease-out;
    border-radius: var(--radius-small);
    scroll-margin-top: 90px;
}

@keyframes glow {
    0%, 40% { background: color-mix(in srgb, var(--page) 30%, transparent); }
    100% { background: transparent; }
}

[id] { scroll-margin-top: 90px; }

/* Lists of subjects and courses */

.rows {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.rows a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 0.5px solid var(--separator);
    text-decoration: none;
    font-size: 19px;
}

.rows a:hover .name { text-decoration: underline; }

.rows .bar {
    flex: none;
    width: 4px;
    height: 28px;
    border-radius: 2px;
    background: var(--page);
    opacity: 0.8;
}

.rows .name { flex: 1; }

.rows .note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 14px;
    color: var(--secondary);
}

.rows .note svg { width: 14px; height: 14px; }

.rows .chevron {
    flex: none;
    width: 14px;
    height: 14px;
    color: var(--tertiary);
}

/* Home */

.intro {
    margin: 4px 0 18px;
    font-size: 18px;
    color: var(--secondary);
}

.searchbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 6px;
    padding: 10px 14px;
    border-radius: var(--radius-medium);
    background: var(--bg-grouped);
}

@media (prefers-color-scheme: dark) {
    .searchbox { background: var(--card); }
}

.searchbox svg { width: 18px; height: 18px; color: var(--secondary); flex: none; }

.searchbox input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    outline: none;
}

.scope {
    display: inline-flex;
    margin: 8px 0 6px;
    padding: 2px;
    border-radius: 9px;
    background: var(--bg-grouped);
}

@media (prefers-color-scheme: dark) {
    .scope { background: var(--card); }
}

.scope button {
    border: 0;
    padding: 6px 18px;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font: 600 14px var(--sans);
    cursor: pointer;
}

.scope button[aria-pressed="true"] {
    background: var(--bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
    .scope button[aria-pressed="true"] { background: #636366; }
}

.results-count {
    font-size: 14px;
    color: var(--secondary);
    margin: 8px 0 0;
}

.results a {
    display: block;
    padding: 12px 0;
    border-bottom: 0.5px solid var(--separator);
    text-decoration: none;
}

.results a:hover .where { text-decoration: underline; }

.results .where { font-weight: 600; }
.results .text { display: block; color: var(--secondary); font-size: 15px; }
.results mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; }

/* The app */

.promo {
    display: flex;
    gap: 16px;
    align-items: center;
    margin: 36px 0 12px;
    padding: 18px;
    border-radius: var(--radius-large);
    background: var(--bg-grouped);
}

@media (prefers-color-scheme: dark) {
    .promo { background: var(--card); }
}

.promo img {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 14px;
}

.promo h2 {
    margin: 0;
    font: 600 20px var(--serif);
}

.promo p {
    margin: 4px 0 10px;
    font-size: 15px;
    color: var(--secondary);
}

/* Source and footer */

.source {
    margin: 32px 0 8px;
    text-align: center;
}

.source::before {
    content: "";
    display: block;
    width: 40px;
    height: 1px;
    margin: 0 auto 8px;
    background: var(--separator);
}

.source .label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--tertiary);
}

.source .cite {
    font: 14px var(--serif);
    color: var(--secondary);
}

footer.site {
    margin-top: 40px;
    padding: 24px 0 40px;
    border-top: 0.5px solid var(--separator);
    font-size: 13px;
    color: var(--secondary);
}

footer.site p { margin: 0 0 8px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    details.section > summary .chevron { transition: none; }
    :target, .lines p.target { animation: none; background: color-mix(in srgb, var(--page) 20%, transparent); }
}

@media print {
    .topbar, .promo, footer.site, .searchbox { display: none; }
    details.section > summary .chevron { display: none; }
}

/* Developer pages */

.app-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 18px 0 8px;
}

.app-hero img {
    flex: none;
    width: 112px;
    height: 112px;
    border-radius: 25px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.app-hero h1 {
    margin: 0;
    font: 600 clamp(26px, 5vw, 34px)/1.15 var(--serif);
}

.app-hero p {
    margin: 6px 0 12px;
    color: var(--secondary);
}

.app-hero .price {
    font-size: 14px;
    color: var(--secondary);
    margin-left: 8px;
}

h2.heading {
    margin: 28px 0 8px;
    font: 600 22px var(--serif);
}

.bullets {
    margin: 0 0 8px;
    padding-left: 22px;
}

.bullets li { margin-bottom: 6px; }

.bullets.columns { columns: 2 260px; column-gap: 32px; }

@media (max-width: 520px) {
    .app-hero { flex-direction: column; align-items: flex-start; }
    .app-hero img { width: 88px; height: 88px; border-radius: 20px; }
}

.rows.apps img {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}
