/* Brand tokens */
:root {
    /* colors */
    --brand: #1EB84C;        /* 吹田塾グリーン */
    --brand-600: #18A443;    /* hover */
    --navy: #1B2A41;         /* 見出し/本文 */
    --accent: var(--navy);   /* 通常リンク色 */
    --bg: #FFFFFF;           /* ベース */
    --surface: #F5F5F5;      /* 交互背景 */
    --border: #E5E7EB;       /* 罫線 */
    --focus: 0 0 0 3px rgba(27, 42, 65, .32);
    --sun: #DC2626;          /* 日曜 */
    --sat: #2563EB;          /* 土曜 */
    /* type colors */
    --type-math: #2563EB;          /* 数学: 青系 */
    --type-science: var(--brand);  /* 理科: 既存のブランド緑 */
    --type-private: #F97316;       /* 個別: オレンジ系 */
    --type-math-bg: #E7EEFF;
    --type-science-bg: #E6FFEF;
    --type-private-bg: #FFEAD5;

    /* typography */
    --font-sans: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, system-ui, sans-serif;
    --font-serif: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif; /* unused */
    /* layout */
    --radius: 12px;
    --shadow-sm: 0 4px 16px rgba(0,0,0,.06);
}

/* Base */
html, body {
    background: var(--bg);
    color: var(--navy);
    font-family: var(--font-sans);
}

h1, h2, h3 { font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus); }

/* Header tweak */
.site-header {
    background: linear-gradient(180deg, rgba(30,184,76,.08), rgba(30,184,76,0));
    padding: 8px 0;
}
.site-header h1 { margin: 6px 0 2px; }
.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-line { margin-top: 6px; font-size: 0.95rem; }
.btn-line { background: #06C755; border-color: #06C755; color: #fff; padding: 8px 12px; border-radius: 999px; }
.btn-line:hover { background: #05b34d; }
.header-cta { display: none; }
@media (min-width: 601px) {
  .header-cta { display: inline-flex; }
}

/* Footer */
.site-footer { padding: 8px 0; }
.site-footer .page-wrap { text-align: center; }

/* availability matrix */
table.matrix {
    width: 100%;
    border-collapse: collapse;
}
table.matrix th,
table.matrix td {
    border-bottom: 1px solid var(--border);
    padding: 8px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
table.matrix thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}
.matrix thead .head-md,
.matrix thead .head-dow { display: inline; }
.matrix thead .head-md::after { content: '('; margin: 0 .1em; }
.matrix thead .head-dow::after { content: ')'; }
.matrix tr > * + * {
    /* vertical separators between columns */
    border-left: 1px solid var(--border);
}
.matrix thead th.dow-sun { color: var(--sun); }
.matrix thead th.dow-sat { color: var(--sat); }
.matrix thead th.hol { color: var(--sun); }

/* (reverted) removed slide containers; simple table render */
.slot.ok { color: var(--brand); font-weight: 700; }
.slot.ng { color: #b42318; }

/* type badges inside cells */
.type-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.85em;
    line-height: 1.6;
    border: 1px solid transparent;
    white-space: nowrap;
}
.type-badge.type-science { background: var(--type-science-bg); color: var(--type-science); border-color: rgba(30,184,76,.35); }
.type-badge.type-math { background: var(--type-math-bg); color: var(--type-math); border-color: rgba(37,99,235,.35); }
.type-badge.type-private { background: var(--type-private-bg); color: var(--type-private); border-color: rgba(249,115,22,.35); }

.matrix-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 12px;
}
.btn-week {
    appearance: none;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color .15s ease;
}
.btn-week:focus {
    outline: none;
    box-shadow: var(--focus);
}
.btn-week:hover { background: var(--brand-600); }
.btn-week[disabled] {
    background: var(--border);
    color: #9CA3AF;
    cursor: not-allowed;
}
.matrix-range { font-weight: 600; }

/* Compact matrix on small screens */
@media (max-width: 600px) {
    table.matrix { table-layout: fixed; font-size: 12px; }
    table.matrix th, table.matrix td { padding: 4px; }
    table.matrix thead th { white-space: nowrap; font-size: 11px; }
    .matrix thead .head-md,
    .matrix thead .head-dow { display: block; }
    .matrix thead .head-md::after,
    .matrix thead .head-dow::after { content: none; }
    table.matrix th:first-child { width: 56px; }
    .slot.ok, .slot.ng { font-size: 12px; }
    .type-badge { font-size: 11px; padding: 1px 6px; margin-left: 4px; }
    /* break 集団数学 into 2 lines */
    .type-badge .type-line-1,
    .type-badge .type-line-2 { display: block; line-height: 1.1; }
    .type-badge .type-sep { display: none; }
}

/* Filters card */
.filters-card {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 10px;
    margin-bottom: 10px;
}

/* Matrix controls: place next button on the right */
.matrix-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 6px 0 10px;
}
@media (max-width: 600px) {
    .matrix-controls { margin: 4px 0 8px; }
}

/* Ensure header CTA is hidden on small screens (override .btn default) */
@media (max-width: 600px) {
  .header-cta { display: none !important; }
}

/* Mobile fixed CTA */
.mobile-cta {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 12px);
    z-index: 20;
    text-align: center;
    justify-content: center;
}
@media (min-width: 601px) {
    .mobile-cta { display: none !important; }
}
@media (max-width: 600px) {
    body { padding-bottom: 72px; }
    .mobile-cta { left: 0; right: 0; border-radius: 0; }
}
.filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}
@media (max-width: 600px) {
    .filters {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}
.select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.select:focus-visible { outline: none; box-shadow: var(--focus); }

.filters-actions { display: flex; justify-content: flex-end; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 600;
}
.btn--ghost {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--navy);
    padding: 8px 14px;
}
.btn--ghost:hover { background: var(--surface); }

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
}
.chip .chip-x {
    cursor: pointer;
    color: var(--navy);
}
@media (max-width: 600px) {
    /* モバイルは高さを抑えるため選択チップは非表示 */
    .active-filters { display: none; }
    .filters-card { padding: 8px; }
}
