/* ============================================
   memorize.it — main stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Mono:wght@400;500&family=Bricolage+Grotesque:wght@400;600;800&display=swap');

/* --- variables --- */
:root {
    --ink: #0f0f0f;
    --paper: #f7f4ef;
    --muted: #9a9590;
    --line: #e0dbd4;
    --white: #ffffff;
    --error: #c0392b;
    --error-bg: #fdf0ee;
}

/* --- reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- base --- */
body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Bricolage Grotesque', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* notebook lines background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 31px,
        var(--line) 31px,
        var(--line) 32px
    );
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

/* --- navbar --- */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--ink);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 52px;
}

.nav-brand {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    color: var(--paper);
    font-size: 1.3rem;
    margin-right: auto;
    letter-spacing: -0.02em;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 1rem;
    height: 52px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    border-left: 1px solid #1f1f1f;
}

nav a:hover { color: var(--paper); }
nav a.active { color: var(--paper); }

/* --- page layout --- */
.page {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
}

/* --- page header --- */
.page-header {
    margin-bottom: 3rem;
}

.page-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1.5px solid var(--line);
    padding: 4px 10px;
    border-radius: 2px;
    margin-bottom: 1rem;
}

h1 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-style: italic;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--ink);
}

h1 span {
    font-style: normal;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: 0.55em;
    display: block;
    letter-spacing: -0.01em;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

/* --- cards --- */
.card {
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 0 var(--line);
}

.card-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
    display: block;
}

/* --- textarea --- */
textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: vertical;
    font-family: 'DM Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.8;
    color: var(--ink);
    background: transparent;
    min-height: 180px;
    display: block;
}

textarea::placeholder {
    color: #c8c3bc;
}

/* --- divider --- */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* --- upload zone --- */
.upload-zone {
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-zone:hover {
    border-color: var(--ink);
    background: #faf9f7;
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 0.8rem;
    color: var(--muted);
    font-family: 'DM Mono', monospace;
}

/* --- buttons --- */
.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.5rem;
}

.btn-primary {
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 0.8rem 2rem;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 3px 0 #3a3a3a;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #3a3a3a; }
.btn-primary:active { transform: translateY(2px); box-shadow: none; }

.btn-ready {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 0.9rem 2.5rem;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 3px 0 #3a3a3a;
    text-decoration: none;
}

.btn-ready:hover { transform: translateY(-1px); box-shadow: 0 5px 0 #3a3a3a; }
.btn-ready::after { content: '→'; font-size: 1.1em; }

.btn-submit {
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 3px 0 #3a3a3a;
    white-space: nowrap;
}

.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #3a3a3a; }
.btn-submit:active { transform: translateY(2px); box-shadow: none; }

.btn-mic {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--line);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-mic:hover { border-color: var(--ink); }

.btn-mic.listening {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    animation: pulse 1s infinite;
}

/* --- preview section (input page) --- */
.preview-section {
    margin-top: 2.5rem;
    animation: fadeUp 0.4s ease;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.preview-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.preview-box {
    background: var(--white);
    border: 1.5px solid var(--line);
    border-left: 4px solid var(--ink);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.9;
    color: var(--ink);
    white-space: pre-wrap;
    margin-bottom: 1.5rem;
}

.hidden-tag {
    display: inline-block;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* --- training page --- */
.progress-wrap {
    margin-bottom: 2.5rem;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.progress-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.progress-count {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
}

.progress-bar {
    height: 4px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--ink);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.text-area {
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 0 var(--line);
}

.text-area-header {
    background: var(--ink);
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3a3a3a;
}

.dot.active { background: var(--paper); }

.text-body {
    padding: 1.75rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    line-height: 2;
}

.text-line {
    display: block;
    color: var(--ink);
    padding: 2px 0;
    animation: fadeIn 0.3s ease;
}

.hidden-slot {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    animation: fadeIn 0.3s ease;
}

.hidden-badge {
    flex-shrink: 0;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
}

.hidden-line-bar {
    flex: 1;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--ink) 0px,
        var(--ink) 6px,
        transparent 6px,
        transparent 12px
    );
    opacity: 0.25;
}

.input-card {
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 0 var(--line);
}

.input-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
    display: block;
}

.input-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.answer-input {
    flex: 1;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    color: var(--ink);
    background: var(--paper);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.answer-input:focus {
    border-color: var(--ink);
    background: var(--white);
}

.answer-input.wrong {
    border-color: var(--error);
    background: var(--error-bg);
    animation: shake 0.3s ease;
}

.error-msg {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--error);
    font-size: 0.8rem;
    font-weight: 600;
    animation: fadeIn 0.2s ease;
}

.error-msg::before { content: '✗'; font-size: 0.9rem; }

/* --- animations --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}



@media (max-width: 600px) {
    nav a {
        display: none;  /* hide nav links, keep just the brand */
    }

    .input-row {
        flex-direction: column;  /* stack input, mic, button vertically */
    }

    .btn-submit, .btn-mic {
        width: 100%;
    }

    .page {
        padding: 2rem 1rem 4rem;
    }

    h1 {
        font-size: 2rem;
    }
}