Files
pdga-rating/public/css/mobile.css
T
Samuel Enocsson e21e6f2ef0
Release / release (push) Successful in 7s
fix: couple mobile add-bar offset to container padding via CSS var
Previously .mobile-add-bar { margin-bottom: -80px } was hardcoded
to match .container { padding-bottom: 80px }. Now both reference
--m-container-pad-bottom so they can't drift out of sync.
2026-05-22 22:11:20 +02:00

643 lines
16 KiB
CSS

/* ═══════════════════════════════════════════════════
PDGA Ratings — Mobile Styles (≤ 880px)
All rules scoped inside @media (max-width: 880px)
unless marked "default hidden" (for elements that
must be display:none on desktop too).
═══════════════════════════════════════════════════ */
/* ── Default-hidden mobile elements ──────────────── */
/* Hidden on ALL viewports; mobile.css un-hides them */
.topbar__mobile { display: none; }
.mobile-list { display: none; }
.mobile-add-bar { display: none; }
.mobile-section-head { display: none; }
.m-tab-pill { display: none; }
.m-search-input { display: none; }
/* ═══════════════════════════════════════════════════ */
@media (max-width: 880px) {
/* ── Desktop elements → hide on mobile ─────────── */
.topbar__inner { display: none !important; }
.kpi-strip { display: none !important; }
.add-bar { display: none !important; }
.footnote { display: none !important; }
.table-toolbar { display: none !important; }
/* Hide desktop search card on mobile (mobile has .m-search-input instead) */
.card-section { display: none; }
/* ── Mobile course search input ─────────────────── */
.m-search-input {
display: block;
width: 100%;
height: 38px;
padding: 0 12px;
background: var(--paper-2);
border: 1px solid var(--line-2);
border-radius: 10px;
font-family: var(--font-sans);
font-size: 14px;
color: var(--ink);
outline: none;
box-sizing: border-box;
transition: border-color 150ms ease, box-shadow 150ms ease;
}
.m-search-input::placeholder {
color: var(--ink-3);
opacity: 0.7;
}
.m-search-input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}
/* Hide desktop table but keep .table-card as wrapper */
.table-card > #ratings-table table,
#ratings-table table,
#courses-table table {
display: none;
}
/* Hide search result info text on courses (mobile has section-head) */
#search-results-info { display: none; }
/* ── Container ──────────────────────────────────── */
.container {
--m-container-pad-bottom: 80px;
padding: 10px 12px var(--m-container-pad-bottom);
gap: 12px;
}
/* ── Topbar mobile ──────────────────────────────── */
.topbar__mobile {
display: flex;
flex-direction: column;
gap: 0;
padding: 0;
}
.topbar__mobile-row1 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px 8px;
gap: 10px;
}
.topbar__mobile-brand {
display: flex;
align-items: center;
gap: 10px;
text-decoration: none;
}
.topbar__mobile-mark {
width: 26px;
height: 26px;
border-radius: 8px;
background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, black));
display: flex;
align-items: center;
justify-content: center;
color: #fff;
flex-shrink: 0;
}
.topbar__mobile-mark svg {
width: 16px;
height: 16px;
}
.topbar__mobile-brand-text {
display: flex;
flex-direction: column;
line-height: 1.1;
}
.topbar__mobile-title {
font-size: 13px;
font-weight: 700;
letter-spacing: -0.01em;
color: var(--ink);
}
.topbar__mobile-sub {
font-size: 9.5px;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--ink-3);
}
.topbar__mobile-refresh {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 8px;
border: 1px solid var(--line);
background: var(--paper);
color: var(--ink);
cursor: pointer;
font-size: 16px;
font-family: var(--font-sans);
transition: background 120ms ease, border-color 120ms ease;
flex-shrink: 0;
padding: 0;
}
.topbar__mobile-refresh:hover:not(:disabled) {
background: var(--hover);
border-color: color-mix(in oklab, var(--line) 60%, var(--ink-3));
}
.topbar__mobile-refresh:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.topbar__mobile-refresh .topbar__refresh-spinner {
display: none;
width: 14px;
height: 14px;
border: 2px solid var(--line);
border-top-color: var(--accent);
border-radius: 50%;
animation: topbar-spin 0.7s linear infinite;
}
.topbar__mobile-refresh.htmx-request .topbar__refresh-spinner {
display: inline-block;
}
.topbar__mobile-refresh.htmx-request .topbar__refresh-icon {
display: none;
}
.topbar__mobile-row2 {
padding: 0 16px 10px;
}
.topbar__mobile-nav {
display: flex;
background: var(--paper-2);
border: 1px solid var(--line);
border-radius: 10px;
padding: 4px;
gap: 2px;
}
.topbar__mobile-nav a {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 1;
height: 28px;
border-radius: 7px;
font-size: 13px;
font-weight: 600;
color: var(--ink-2);
text-decoration: none;
transition: color 120ms ease, background 120ms ease;
}
.topbar__mobile-nav a:hover {
color: var(--ink);
}
.topbar__mobile-nav a.active {
background: var(--paper);
color: var(--ink);
box-shadow: var(--shadow-card);
}
/* ── Mobile section head ────────────────────────── */
.mobile-section-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 0 2px;
}
/* pill-button for "Trend chart" toggle in mobile section head */
.pill-button {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-radius: 999px;
border: 1px solid var(--line-2);
background: var(--paper-2);
color: var(--ink-2);
font-size: 11px;
font-weight: 600;
font-family: var(--font-sans);
cursor: pointer;
transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.pill-button:hover {
background: var(--hover);
border-color: var(--line);
}
.pill-button[aria-pressed="true"] {
background: color-mix(in oklab, var(--accent) 10%, white);
border-color: color-mix(in oklab, var(--accent) 35%, var(--line-2));
color: var(--accent-text);
}
/* ── Mobile list wrapper ────────────────────────── */
.mobile-list {
display: flex;
flex-direction: column;
gap: 10px;
padding-bottom: 90px;
}
/* ── Player card ────────────────────────────────── */
.m-card {
background: var(--paper);
border: 1px solid var(--line);
border-radius: 14px;
padding: 12px;
box-shadow: var(--shadow-card);
cursor: pointer;
transition: background 120ms ease;
}
.m-card:hover {
background: var(--hover);
}
.m-card__head {
display: flex;
align-items: center;
gap: 10px;
}
.m-rank-chip {
width: 24px;
height: 24px;
border-radius: 6px;
background: var(--paper-2);
border: 1px solid var(--line);
display: flex;
align-items: center;
justify-content: center;
font-family: var(--font-mono);
font-size: 11px;
font-weight: 600;
color: var(--ink-3);
flex-shrink: 0;
}
.m-rank-chip--first {
background: var(--accent-soft);
color: var(--accent-text);
border-color: color-mix(in oklab, var(--accent) 25%, transparent);
}
.m-card__name-stack {
display: flex;
flex-direction: column;
gap: 1px;
flex: 1;
min-width: 0;
}
.m-player-name {
font-size: 14px;
font-weight: 600;
color: var(--ink);
letter-spacing: -0.005em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.m-pdga-num {
font-family: var(--font-mono);
font-size: 11px;
color: var(--ink-3);
}
.m-chevron {
color: var(--ink-3);
font-size: 14px;
flex-shrink: 0;
transition: transform 180ms ease;
line-height: 1;
}
.m-card.is-open .m-chevron {
transform: rotate(180deg);
}
.m-card__body {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 10px;
align-items: center;
margin-top: 8px;
}
.m-card__stats {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
}
.m-stat-row {
display: flex;
align-items: center;
gap: 8px;
}
.m-stat-label {
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--ink-3);
width: 62px;
flex-shrink: 0;
}
.m-num {
font-family: var(--font-mono);
font-feature-settings: "tnum", "zero";
font-size: 18px;
font-weight: 600;
color: var(--ink);
letter-spacing: -0.02em;
line-height: 1;
}
.m-num--predicted {
color: var(--ink-2);
}
/* Override delta-pill size inside mobile cards */
.m-card .delta-pill {
font-size: 11px;
padding: 2px 7px 2px 5px;
}
.m-card__sparkline {
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
}
.m-chart-spark {
display: block;
}
/* ── Player card expand panel ───────────────────── */
.m-card__expand {
display: none;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--line);
}
.m-card.is-open .m-card__expand {
display: block;
}
.m-chart {
width: 100%;
max-width: 480px;
}
.m-detail-grid {
display: grid;
grid-template-columns: 1fr;
margin: 10px 0 0;
padding: 0;
list-style: none;
}
.m-detail-grid > div {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 12px;
padding: 6px 0;
border-bottom: 1px dashed var(--line);
}
.m-detail-grid > div:last-child {
border-bottom: none;
}
.m-detail-grid dt {
color: var(--ink-2);
font-size: 12px;
font-weight: 400;
flex-shrink: 0;
}
.m-detail-grid dd {
color: var(--ink);
font-size: 12px;
font-family: var(--font-mono);
font-feature-settings: "tnum", "zero";
margin: 0;
text-align: right;
}
/* ── Courses mobile tab pill ────────────────────── */
.m-tab-pill {
display: flex;
background: var(--paper-2);
border: 1px solid var(--line);
border-radius: 10px;
padding: 4px;
gap: 2px;
margin-bottom: 4px;
}
.m-tab-pill__btn {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 1;
height: 30px;
border-radius: 7px;
font-size: 13px;
font-weight: 600;
font-family: var(--font-sans);
color: var(--ink-2);
background: transparent;
border: none;
cursor: pointer;
transition: color 120ms ease, background 120ms ease;
}
.m-tab-pill__btn--active {
background: var(--paper);
color: var(--ink);
box-shadow: var(--shadow-card);
}
.m-tab-pill__btn--disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
/* ── Course card ────────────────────────────────── */
.m-course-card {
background: var(--paper);
border: 1px solid var(--line);
border-radius: 14px;
padding: 12px;
box-shadow: var(--shadow-card);
cursor: pointer;
transition: background 120ms ease;
}
.m-course-card:hover {
background: var(--hover);
}
.m-course-card__head {
display: flex;
align-items: center;
gap: 10px;
}
.m-course-card__name-stack {
display: flex;
flex-direction: column;
gap: 2px;
flex: 1;
min-width: 0;
}
.m-course-name-row {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.m-course-name {
font-size: 14px;
font-weight: 600;
color: var(--ink);
letter-spacing: -0.005em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.m-layouts-pill {
font-family: var(--font-mono);
font-size: 11px;
padding: 2px 7px;
border-radius: 999px;
background: var(--paper-2);
border: 1px solid var(--line-2);
color: var(--ink-3);
white-space: nowrap;
flex-shrink: 0;
}
.m-course-card__meta {
font-size: 12px;
color: var(--ink-3);
margin-top: 2px;
}
.m-course-card__expand {
display: none;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--line);
}
.m-course-card.is-open .m-course-card__expand {
display: block;
}
.m-course-card.is-open .m-chevron {
transform: rotate(180deg);
}
/* ── Sticky mobile add-bar ──────────────────────── */
.mobile-add-bar {
display: flex;
gap: 8px;
padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) 12px;
background: color-mix(in oklab, var(--paper) 88%, transparent);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-top: 1px solid var(--line);
position: sticky;
bottom: 0;
z-index: 10;
/* Negative margin to break out of container padding */
margin-left: -12px;
margin-right: -12px;
margin-bottom: calc(-1 * var(--m-container-pad-bottom));
}
.mobile-add-bar input {
flex: 1;
height: 38px;
background: var(--paper-2);
border: 1px solid var(--line-2);
border-radius: 10px;
padding: 0 14px;
font-family: var(--font-mono);
font-size: 14px;
color: var(--ink);
font-feature-settings: "tnum";
outline: none;
transition: border-color 150ms ease, box-shadow 150ms ease;
}
.mobile-add-bar input::placeholder {
color: var(--ink-3);
opacity: 0.7;
}
.mobile-add-bar input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}
.mobile-add-bar .btn-primary {
height: 38px;
padding: 0 18px;
flex-shrink: 0;
}
/* ── Table-card: remove overflow:hidden on mobile ─ */
/* so sticky add-bar can extend to bottom */
.table-card {
overflow: visible;
}
} /* end @media (max-width: 880px) */