/* =============================================
   Study Better — Study Notebook Visual System
   ============================================= */

:root {
    --primary:      #203a5f;
    --primary-dk:   #162a46;
    --primary-lt:   #2e5280;
    --teal:         #4f7f7a;
    --teal-pale:    #e6efed;
    --teal-mid:     #c0d8d5;
    --yellow:       #d5ad54;
    --yellow-pale:  #fdf6e3;
    --yellow-mid:   #ecd98a;
    --paper:        #faf9f5;
    --paper-alt:    #f2efe6;
    --surface:      #ffffff;
    --soft-blue:    #e8eef5;
    --soft-blue-dk: #c8d5e5;
    --text-dark:    #252a30;
    --text-body:    #2e3540;
    --text-muted:   #68717b;
    --border:       #d9dde2;
    --border-dk:    #b8bec5;
    --warning:      #855a43;
    --warn-pale:    #f7f0ec;
    --shadow:       0 2px 10px rgba(32,58,95,0.07);
    --radius:       6px;
    --radius-lg:    12px;
}

/* ---- Base ---- */
html { scroll-behavior: smooth; }
body {
    background: var(--paper);
    color: var(--text-body);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.78;
}
section[id], article[id] { scroll-margin-top: 95px; }

h1,h2,h3,h4,h5,h6 {
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.7rem); }
h3 { font-size: clamp(1.05rem, 2vw, 1.22rem); }
a  { color: var(--primary); }
a:hover { color: var(--primary-lt); }

/* ---- Navbar ---- */
.site-nav {
    background: var(--surface);
    border-bottom: 3px solid var(--primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1040;
}
.site-nav .navbar-brand {
    font-weight: 800;
    font-size: 1.18rem;
    color: var(--primary) !important;
    letter-spacing: -0.03em;
}
.site-nav .navbar-brand .tagline {
    display: block;
    font-size: 0.64rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1;
    letter-spacing: 0;
}
.site-nav .nav-link {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-dark) !important;
    padding: 0.35rem 0.6rem !important;
    border-radius: var(--radius);
    transition: background 0.13s;
}
.site-nav .nav-link:hover,
.site-nav .nav-link.active {
    background: var(--soft-blue);
    color: var(--primary) !important;
}
.site-nav .nav-link.active { font-weight: 700; }

/* ---- Breadcrumb ---- */
.breadcrumb-bar {
    background: var(--paper-alt);
    border-bottom: 1px solid var(--border);
    padding: 0.3rem 0;
    font-size: 0.77rem;
}
.breadcrumb-bar .breadcrumb { margin:0; background:none; padding:0; }
.breadcrumb-item a { color: var(--primary); text-decoration:none; font-weight:500; }
.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ---- Hero ---- */
.hero-section {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 3.2rem 0 2.2rem;
}
.study-desk {
    background: var(--paper);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    box-shadow: var(--shadow);
    position: relative;
}
.study-desk::before {
    content: '';
    display: block;
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--yellow) 0, var(--yellow) 18px, transparent 18px, transparent 22px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: absolute;
    top:0; left:0; right:0;
}
.desk-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.7rem;
    display: block;
}
.desk-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    font-size: 0.81rem;
}
.desk-row:last-child { margin-bottom: 0; }
.desk-row .bi { font-size: 0.95rem; margin-top: 0.06rem; flex-shrink:0; }
.desk-row strong { display:block; font-size:0.76rem; font-weight:700; color:var(--text-dark); margin-bottom:0.05rem; }
.desk-row span { color:var(--text-muted); font-size:0.77rem; }
.desk-row.priority .bi { color:var(--primary); }
.desk-row.session .bi  { color:var(--teal); }
.desk-row.method .bi   { color:var(--yellow); }
.desk-row.after .bi    { color:#7a60b8; }

/* ---- Subject Tabs ---- */
.subject-strip {
    background: var(--primary);
    padding: 0.55rem 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.subject-strip::-webkit-scrollbar { display:none; }
.subject-strip .container { display:flex; gap:0.4rem; }
.subject-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.79rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.08);
    border: 1.5px solid rgba(255,255,255,0.14);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.13s;
}
.subject-tab:hover, .subject-tab.active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

/* ---- Study Cycle ---- */
.study-cycle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.cycle-step {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    text-align: center;
    min-width: 180px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary);
    position: relative;
}
.cycle-arrow {
    font-size: 1.1rem;
    color: var(--teal);
    margin: 0.1rem 0;
    line-height: 1;
}

/* ---- Notebook Section ---- */
.notebook-section {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.65rem;
    margin-bottom: 1.4rem;
    box-shadow: var(--shadow);
    position: relative;
}
.notebook-section::before {
    content: '';
    display: block;
    width: 4px;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
    position: absolute;
    top: 0; left: 0; bottom: 0;
}
.notebook-section.teal::before  { background: var(--teal); }
.notebook-section.yellow::before { background: var(--yellow); }
.notebook-section.alt { background: var(--soft-blue); }
.notebook-section.paper { background: var(--paper-alt); }

/* ---- Callout Boxes ---- */
.callout {
    border-radius: var(--radius);
    padding: 0.85rem 1.05rem;
    margin: 0.7rem 0;
    border-left: 4px solid;
    font-size: 0.89rem;
}
.callout-try     { background: var(--teal-pale);  border-color: var(--teal); }
.callout-mistake { background: var(--warn-pale);   border-color: var(--warning); }
.callout-reflect { background: #f0ecf8;             border-color: #8c6cbe; }
.callout-note    { background: var(--paper-alt);   border-color: var(--border-dk); }
.callout-easier  { background: var(--yellow-pale); border-color: var(--yellow); }
.callout-tip     { background: var(--soft-blue);   border-color: var(--primary); }
.callout-warn    { background: var(--warn-pale);   border-color: var(--warning); }

.callout h5, .callout h6 {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.28rem;
}
.callout-try     h5,.callout-try     h6 { color: var(--teal); }
.callout-mistake h5,.callout-mistake h6 { color: var(--warning); }
.callout-reflect h5,.callout-reflect h6 { color: #6048a0; }
.callout-easier  h5,.callout-easier  h6 { color: #8a6210; }
.callout-tip     h5,.callout-tip     h6 { color: var(--primary); }
.callout-warn    h5,.callout-warn    h6 { color: var(--warning); }

/* ---- Steps list ---- */
.steps-ol { list-style:none; padding:0; margin:0; }
.steps-ol li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    font-size: 0.88rem;
}
.step-num {
    min-width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.73rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.12rem;
}

/* ---- Category labels ---- */
.cat-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.69rem;
    font-weight: 700;
    padding: 0.14rem 0.52rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid;
}
.cp-planning  { background:#e8eef5; color:#1a3a6a; border-color:#b8cee8; }
.cp-focus     { background:var(--teal-pale); color:#2a5550; border-color:var(--teal-mid); }
.cp-notes     { background:var(--yellow-pale); color:#6a4a10; border-color:var(--yellow-mid); }
.cp-revision  { background:#f0ecf8; color:#4a2888; border-color:#c8b0e8; }
.cp-exams     { background:var(--warn-pale); color:var(--warning); border-color:#d8b8a8; }
.cp-reading   { background:#e0f5ee; color:#1a5030; border-color:#90d8b8; }
.cp-memory    { background:#fff0e0; color:#804820; border-color:#e8c890; }
.cp-homework  { background:#f5e8f5; color:#7a3888; border-color:#d8b8d8; }
.cp-time      { background:#e8f0ff; color:#2a3880; border-color:#b0c0e8; }
.cp-org       { background:var(--paper-alt); color:var(--text-muted); border-color:var(--border); }
.cp-learning  { background:#e0f5ee; color:#206040; border-color:#90d8b8; }
.cp-environment { background:var(--soft-blue); color:#1a3060; border-color:var(--soft-blue-dk); }
.cp-default   { background:var(--paper-alt); color:var(--text-muted); border-color:var(--border); }

/* ---- Filter bar ---- */
.filter-bar {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 0.55rem 0;
    position: sticky;
    top: 61px;
    z-index: 900;
    box-shadow: 0 2px 6px rgba(32,58,95,0.05);
}
.filter-chips {
    display: flex;
    gap: 0.3rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display:none; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.23rem 0.7rem;
    border-radius: 20px;
    font-size: 0.77rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.13s;
}
.filter-chip:hover, .filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---- Section header ---- */
.section-eyebrow {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.18rem;
}
.section-rule {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.4rem;
}
.section-rule h2 { margin:0; }
.section-rule::after { content:''; flex:1; height:1px; background:var(--border); }

/* ---- Tip entry ---- */
.tip-entry.hidden { display:none; }

/* ---- Planner grid ---- */
.planner-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    margin: 1rem 0;
}
.planner-day {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.4rem;
    text-align: center;
    font-size: 0.76rem;
}
.planner-day .day-name {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    display: block;
}
.planner-day .day-task {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}
@media (max-width: 576px) {
    .planner-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Comparison table ---- */
.method-table { font-size: 0.84rem; }
.method-table th { background: var(--primary); color:#fff; font-size:0.78rem; font-weight:600; }
.method-table td { vertical-align: middle; }
.method-table tr:nth-child(even) td { background: var(--soft-blue); }

/* ---- Routine timeline ---- */
.routine-timeline {
    position: relative;
    padding-left: 2.4rem;
}
.routine-timeline::before {
    content:'';
    position:absolute;
    left: 0.85rem;
    top:0; bottom:0;
    width: 2px;
    background: var(--teal-mid);
}
.rt-step {
    position: relative;
    margin-bottom: 1.2rem;
}
.rt-step::before {
    content:'';
    position:absolute;
    left: -2.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--teal);
    border: 3px solid var(--paper);
    box-shadow: 0 0 0 2px var(--teal);
}
.rt-step p { margin:0; font-size:0.87rem; }

/* ---- Distraction audit ---- */
.distraction-table { font-size: 0.83rem; }
.distraction-table th { background: var(--primary); color:#fff; font-size:0.77rem; }
.distraction-table td { vertical-align: top; }
.distraction-table tr:nth-child(even) td { background: var(--teal-pale); }

/* ---- Study cycle visual ---- */
.cycle-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* ---- Note example ---- */
.note-example {
    background: var(--paper-alt);
    border: 1.5px dashed var(--border-dk);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--text-dark);
    line-height: 1.65;
}

/* ---- Checklist ---- */
.check-list { list-style:none; padding:0; margin:0; }
.check-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.26rem 0;
    font-size: 0.89rem;
    border-bottom: 1px solid var(--border);
}
.check-list li:last-child { border-bottom: none; }
.check-list li .bi { color: var(--teal); margin-top:0.14rem; flex-shrink:0; }

/* ---- Problem→action rows ---- */
.problem-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.problem-row:last-child { border-bottom: none; }
.problem-q {
    flex: 1;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-muted);
}
.problem-arrow { color: var(--teal); font-size: 1rem; flex-shrink:0; margin-top:0.1rem; }
.problem-a { flex: 2; font-size: 0.88rem; }

/* ---- Notice bar ---- */
.notice-bar {
    background: var(--warn-pale);
    border: 1.5px solid #d4b8a8;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: #5a3028;
}
.notice-bar a { color: #7c4030; font-weight:600; }

/* ---- Ad placeholder ---- */
.ad-placeholder {
    background: var(--paper-alt);
    border: 1px dashed var(--border-dk);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.71rem;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- About card ---- */
.about-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
}

/* ---- Footer ---- */
.site-footer {
    background: var(--primary);
    color: #9ab0c8;
    padding: 2.65rem 0 1.2rem;
    margin-top: 3.5rem;
    border-top: 4px solid var(--teal);
}
.site-footer h5 {
    color:#fff;
    font-size:0.77rem;
    text-transform:uppercase;
    letter-spacing:0.08em;
    font-weight:700;
    margin-bottom:0.75rem;
}
.site-footer a {
    color: #9ab0c8;
    text-decoration:none;
    font-size:0.83rem;
    display:block;
    padding:0.12rem 0;
    transition: color 0.13s;
}
.site-footer a:hover { color:#fff; }
.site-footer .footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.9rem;
    margin-top: 1.6rem;
    font-size: 0.74rem;
    color: #5a7090;
}

/* ---- Back to top ---- */
#backToTop {
    position: fixed;
    bottom: 1.4rem; right: 1.4rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 2.4rem; height: 2.4rem;
    font-size: 1rem;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    box-shadow: var(--shadow);
    transition: background 0.13s;
}
#backToTop:hover { background: var(--teal); }
#backToTop.visible { display:flex; }

/* ---- Policy pages ---- */
.policy-section { padding:1.2rem 0; border-bottom:1px solid var(--border); }
.policy-section:last-child { border-bottom:none; }

/* ---- Search ---- */
.search-wrap { position:relative; max-width:280px; }
.search-wrap .bi { position:absolute; left:0.7rem; top:50%; transform:translateY(-50%); color:var(--text-muted); pointer-events:none; }
#tipSearch { padding-left:2.1rem; border-radius:20px; border:1.5px solid var(--border); background:var(--paper); font-size:0.84rem; }

/* ---- Worksheet ---- */
.worksheet {
    background: var(--paper-alt);
    border: 2px dashed var(--border-dk);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    margin: 0.9rem 0;
}
.ws-row { margin-bottom:0.9rem; padding-bottom:0.9rem; border-bottom:1px solid var(--border); }
.ws-row:last-child { margin-bottom:0; padding-bottom:0; border-bottom:none; }
.ws-label { font-size:0.73rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-muted); margin-bottom:0.3rem; display:block; }
.ws-line { border:none; border-bottom:1.5px solid var(--border-dk); background:transparent; width:100%; padding:0.28rem 0; font-size:0.88rem; color:var(--text-muted); }

/* ---- Print ---- */
@media print {
    .site-nav, .filter-bar, .subject-strip, .site-footer,
    #backToTop, .ad-placeholder, .no-print { display:none !important; }
    body { background:#fff; font-size:11pt; }
    .notebook-section { box-shadow:none; border:1px solid #ccc; }
    .notebook-section::before { display:none; }
    a { color:#000; }
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
    .hero-section { padding:1.8rem 0 1.3rem; }
    .planner-grid { gap:0.2rem; }
}

/* ---- Accessibility ---- */
:focus-visible { outline:3px solid var(--teal); outline-offset:2px; border-radius:3px; }
