/* study.askassam.com — "Lamp-lit desk" theme
   Concept: studying after hours by a single warm lamp. Deep ink background,
   one amber light source, everything else quiet. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --bg: #100e17;
    --bg-soft: #17141f;
    --card: #1c1826;
    --card-border: #2e2839;
    --paper: #f6f1e6;
    --ink: #eee9df;
    --muted: #948d9e;
    --muted-dim: #6b6577;
    --lamp: #ffb84d;
    --lamp-dim: #cf9640;
    --ember: #ff7a59;
    --sage: #7cd9a5;
    --radius-lg: 20px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(ellipse 900px 500px at 50% -10%, rgba(255,184,77,0.14), transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: 'Fraunces', Georgia, serif; letter-spacing: -0.01em; }

.wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 20px 70px;
}

/* ---------- Nav ---------- */
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    flex-wrap: wrap;
    margin-bottom: 36px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--card-border);
}
.brand {
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--lamp);
    box-shadow: 0 0 10px 2px rgba(255,184,77,0.7);
    display: inline-block;
}
.brand span { color: var(--muted-dim); font-weight: 500; font-family: 'Inter', sans-serif; }
.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}
.nav-link:hover { color: var(--lamp); }

/* ---------- Eyebrow labels ---------- */
.eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin: 0 0 6px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 18px;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: #3a3350; }

h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink);
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.hero-grid .card { margin-bottom: 0; }

/* ---------- Entrance animation ---------- */
@keyframes revealUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.reveal {
    animation: revealUp 0.5s ease both;
    animation-delay: calc(var(--d, 0) * 70ms);
}
@media (prefers-reduced-motion: reduce) {
    .reveal { animation: none; }
}

/* ---------- Streak card — signature glow ---------- */
.streak-card {
    text-align: center;
    position: relative;
    overflow: hidden;
}
.streak-card::before {
    content: "";
    position: absolute;
    top: -10%; left: 50%;
    transform: translateX(-50%);
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,184,77,0.22), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.streak-card.lit::before { opacity: 1; }

.flame {
    font-size: 2.2rem;
    filter: grayscale(1) opacity(0.35);
    position: relative;
    display: inline-block;
}
.flame-active { filter: none; animation: flameFlicker 2.2s ease-in-out infinite; }
@keyframes flameFlicker {
    0%, 100% { transform: scale(1) rotate(-2deg); }
    50% { transform: scale(1.08) rotate(2deg); }
}
.spark {
    position: absolute;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--lamp);
    opacity: 0;
    top: 4px;
    animation: sparkRise 2.4s ease-in infinite;
}
.spark-a { left: 6px; animation-delay: 0s; }
.spark-b { left: 20px; animation-delay: 0.8s; }
.spark-c { left: 14px; animation-delay: 1.5s; }
@keyframes sparkRise {
    0%   { opacity: 0; transform: translateY(0) scale(0.6); }
    15%  { opacity: 1; }
    80%  { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-34px) scale(0.3); }
}

.streak-num {
    font-family: 'Fraunces', serif;
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 6px;
    color: var(--paper);
    position: relative;
}
.streak-label {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 4px;
    letter-spacing: 0.02em;
}
.streak-msg {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--card-border);
    padding-top: 12px;
}

/* ---------- Goal card ---------- */
.goal-numbers {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
    font-family: 'Fraunces', serif;
}
.goal-current { font-size: 1.7rem; font-weight: 700; color: var(--sage); }
.goal-sep { color: var(--muted-dim); font-size: 1.1rem; }
.goal-target { color: var(--muted); font-size: 1.05rem; }

.progress-track {
    background: var(--bg-soft);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lamp-dim), var(--sage));
    border-radius: 999px;
    transition: width 1s cubic-bezier(.22,1,.36,1);
}
.goal-pct { margin-top: 10px; font-size: 0.82rem; color: var(--muted); }

/* ---------- Donut ---------- */
.donut-card { text-align: center; }
.donut {
    width: 118px;
    height: 118px;
    transform: rotate(-90deg);
    margin: 0 auto 14px;
}
.donut-seg { transition: stroke-dasharray 0.9s cubic-bezier(.22,1,.36,1); }
.legend {
    text-align: left;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 5px;
}

.empty { color: var(--muted); font-size: 0.9rem; }
.empty a { color: var(--lamp); }

/* ---------- Session list ---------- */
.session-list { list-style: none; margin: 0; padding: 0; }
.session-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
    flex-wrap: wrap;
}
.session-list li:last-child { border-bottom: none; }
.chip {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}
.sess-subject { font-weight: 600; flex: 1; min-width: 100px; }
.sess-dur {
    color: var(--lamp);
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'IBM Plex Mono', monospace;
}
.sess-date { color: var(--muted-dim); font-size: 0.78rem; }

/* ---------- Stopwatch (the signature element) ---------- */
.stopwatch-card {
    background: radial-gradient(circle at 50% 0%, rgba(255,184,77,0.10), transparent 65%), var(--bg-soft);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}
.stopwatch-ring {
    width: 168px;
    height: 168px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--card-border);
    position: relative;
    box-shadow: 0 0 0 1px rgba(255,184,77,0.06);
}
.stopwatch-ring::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    padding: 1px;
    background: conic-gradient(var(--lamp) var(--sw-progress, 0%), transparent 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: background 0.3s linear;
}
.stopwatch-ring.running {
    box-shadow: 0 0 0 1px rgba(255,184,77,0.15), 0 0 30px 4px rgba(255,184,77,0.18);
}
.stopwatch-display {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--paper);
    font-variant-numeric: tabular-nums;
}
.stopwatch-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.stopwatch-hint {
    margin: 16px 0 0;
    font-size: 0.8rem;
    color: var(--muted-dim);
}

/* ---------- Form ---------- */
.form-card h1 {
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 600;
}
.session-form { display: flex; flex-direction: column; gap: 16px; }
.session-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}
.session-form input[type=text],
.session-form input[type=password],
.session-form input[type=datetime-local],
.session-form textarea {
    background: var(--bg-soft);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
}
.session-form input:focus,
.session-form textarea:focus {
    outline: 2px solid var(--lamp);
    outline-offset: 1px;
    border-color: transparent;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.type-option {
    position: relative;
    background: var(--bg-soft);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 11px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--muted);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.type-option:hover { border-color: var(--muted-dim); color: var(--ink); }
.type-option input { position: absolute; opacity: 0; }
.type-option:has(input:checked) {
    border-color: var(--accent);
    color: var(--ink);
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-soft));
}

.time-row { display: flex; gap: 12px; flex-wrap: wrap; }
.time-row label { flex: 1; min-width: 160px; }

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--lamp);
    color: #241a08;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: filter 0.12s ease, transform 0.12s ease;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary.small { padding: 8px 16px; font-size: 0.82rem; }

.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--card-border);
    color: var(--muted);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--lamp); color: var(--ink); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: var(--muted);
    padding: 0;
}
.text-btn:hover { color: var(--ember); }

/* ---------- Flash ---------- */
.flash {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.flash-success { background: rgba(124, 217, 165, 0.1); color: var(--sage); border-color: rgba(124,217,165,0.3); }
.flash-error { background: rgba(255, 122, 89, 0.1); color: var(--ember); border-color: rgba(255,122,89,0.3); }

@media (max-width: 480px) {
    .streak-num, .goal-current { font-size: 2.1rem; }
    .stopwatch-ring { width: 140px; height: 140px; }
    .stopwatch-display { font-size: 1.5rem; }
}

/* ---------- Session row hover ---------- */
.session-row { transition: background 0.15s ease; border-radius: 8px; }
.session-row:hover { background: rgba(255,184,77,0.05); }

/* ---------- 7-day trend chart ---------- */
.trend-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    height: 90px;
}
.trend-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.trend-bar-track {
    display: flex;
    align-items: flex-end;
    height: 64px;
}
.trend-bar {
    width: 18px;
    min-height: 6px;
    border-radius: 5px 5px 2px 2px;
    background: var(--card-border);
    transition: height 0.5s cubic-bezier(.34,1.56,.64,1), background 0.2s ease;
}
.trend-bar-today {
    background: linear-gradient(180deg, var(--lamp), var(--lamp-dim));
    box-shadow: 0 0 10px rgba(255,184,77,0.35);
}
.trend-col:hover .trend-bar { background: var(--sage); }
.trend-col:hover .trend-bar-today { background: linear-gradient(180deg, var(--lamp), var(--lamp-dim)); }
.trend-label {
    font-size: 0.72rem;
    color: var(--muted-dim);
}
.trend-label-today { color: var(--lamp); font-weight: 600; }

/* ---------- Milestone badges ---------- */
.badge-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: var(--bg-soft);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    min-width: 64px;
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.badge-unlocked {
    opacity: 1;
    border-color: rgba(255,184,77,0.4);
    background: radial-gradient(circle at 50% 0%, rgba(255,184,77,0.12), transparent 70%), var(--bg-soft);
}
.badge:hover { transform: translateY(-2px); }
.badge-icon { font-size: 1.3rem; }
.badge-num { font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.badge-label { font-size: 0.68rem; color: var(--muted-dim); }

/* ---------- Quick subject chips ---------- */
.quick-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: -6px;
}
.quick-chip {
    background: var(--bg-soft);
    border: 1px solid var(--card-border);
    color: var(--muted);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.quick-chip:hover { border-color: var(--lamp); color: var(--ink); }
.quick-chip-pop { transform: scale(0.92); }

/* ---------- Confetti ---------- */
.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    top: -20px;
    width: 8px;
    height: 12px;
    opacity: 0.9;
    animation-name: confettiFall;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
    border-radius: 2px;
}
@keyframes confettiFall {
    to { top: 100vh; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .confetti-layer { display: none; }
}
