/*
 * Augustine's global theme and navigation, loaded on every page.
 * Colours and fonts follow STYLE_GUIDE_AUGUSTINE.md.
 */
:root {
    --aug-bg: #faf8f3;
    --aug-bg-secondary: #f5f1e8;
    --aug-amber: #d97706;
    --aug-amber-dark: #b45309;
    --aug-amber-light: #fed7aa;
    --aug-text: #4a4a4a;
    --aug-taupe: #8b7355;
    --aug-muted: #999;
    --aug-border: #ece3d2;

    --aug-receipt: #84cc16;
    --aug-recipe: #f59e0b;
    --aug-manual: #06b6d4;
    --aug-shopping: #ec4899;
    --aug-voice: #8b5cf6;
    --aug-warning: #dc2626;

    --aug-bookmarks-height: 4.25rem;
    --aug-desk: #efe7d8;
    --aug-paper: #fffdf8;
    --aug-margin: rgba(220, 38, 38, 0.22);
    --aug-touch: 2.75rem;
}

/* ─── Page basics ─── */
body {
    background: linear-gradient(135deg, var(--aug-bg) 0%, var(--aug-bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--aug-text);
    font-family: 'Nunito', sans-serif;
    line-height: 1.7;
}

.site-main {
    padding: 1.5rem 1rem 3rem;
}

.page {
    max-width: 900px;
    margin: 0 auto;
}

.page-narrow {
    max-width: 480px;
}

.page-head {
    margin-bottom: 2rem;
}

.page-title {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--aug-amber);
}

.page-subtitle {
    margin-top: 0.25rem;
    color: var(--aug-muted);
    font-style: italic;
}

.section-heading {
    margin-bottom: 0.75rem;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--aug-touch);
    color: var(--aug-taupe);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--aug-amber-dark);
}

.handwritten {
    font-family: 'Caveat', cursive;
}

.muted {
    color: var(--aug-muted);
    font-style: italic;
    font-size: 0.95rem;
}

.ink-link {
    display: inline-block;
    padding: 0.6rem 0;
    color: var(--aug-amber);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease-out;
}

.ink-link:hover {
    color: var(--aug-amber-dark);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 4px;
}

/* ─── Cards ─── */
.card {
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card + .card {
    margin-top: 1rem;
}

.card-accent {
    border-left: 4px solid var(--accent, var(--aug-amber));
}

.card-title {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--aug-text);
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.card-grid > .card + .card {
    margin-top: 0;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: var(--aug-touch);
    padding: 0 1.4rem;
    border: 2px solid transparent;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background 0.2s ease-out, color 0.2s ease-out;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn[hidden] {
    display: none;
}

.btn-primary {
    background: var(--aug-amber);
    color: white;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.btn-primary:hover {
    background: var(--aug-amber-dark);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.btn-secondary {
    background: white;
    border-color: var(--aug-amber);
    color: var(--aug-amber);
}

.btn-secondary:hover {
    background: var(--aug-bg);
}

.btn-quiet {
    background: transparent;
    color: var(--aug-taupe);
    padding: 0 0.75rem;
}

.btn-quiet:hover {
    background: var(--aug-bg-secondary);
    transform: none;
}

.btn-danger {
    background: #fef2f2;
    color: var(--aug-warning);
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-voice {
    background: var(--aug-voice);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.btn-voice:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-stop {
    background: var(--aug-warning);
    color: white;
}

.btn-small {
    min-height: 2.25rem;
    padding: 0 0.9rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

/* ─── Forms (Symfony's default form markup inside .form) ─── */
.form > div,
.form .field {
    margin-bottom: 1.25rem;
}

.form label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--aug-taupe);
    font-weight: 600;
    font-size: 0.95rem;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="search"],
.form input[type="password"],
.form input[type="number"],
.form input[type="date"],
.form input[type="datetime-local"],
.form select,
.form textarea {
    display: block;
    width: 100%;
    min-height: var(--aug-touch);
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--aug-border);
    border-radius: 12px;
    background: white;
    color: var(--aug-text);
    font: inherit;
    transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--aug-amber);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.form textarea {
    resize: vertical;
}

/* Checkbox: input and label side by side */
.form .checkbox-row,
.form div:has(> input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.form input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--aug-amber);
}

.form div:has(> input[type="checkbox"]) label {
    margin: 0;
    font-weight: 400;
    color: var(--aug-text);
}

/* Datetime widgets rendered as several selects */
.form div:has(> select + select) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form div:has(> select + select) > select {
    width: auto;
}

.form ul {
    margin: 0.35rem 0 0;
    padding: 0;
    list-style: none;
    color: var(--aug-warning);
    font-size: 0.9rem;
}

.form .help-text {
    color: var(--aug-muted);
    font-size: 0.9rem;
}

/* ─── Alerts (flash messages) ─── */
.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    border-left: 4px solid var(--alert-color);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alert-success { --alert-color: var(--aug-receipt); }
.alert-error { --alert-color: var(--aug-warning); }
.alert-warning { --alert-color: var(--aug-amber); }
.alert-info { --alert-color: var(--aug-manual); }

.flashes {
    max-width: 900px;
    margin: 0 auto;
}

/* ─── Tables (administration) ─── */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th {
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--aug-border);
    color: var(--aug-taupe);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--aug-border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--aug-bg);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ─── Small pieces ─── */
.badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--aug-bg-secondary);
    color: var(--aug-taupe);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-alert {
    background: #fdf2f8;
    color: #be185d;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--aug-taupe);
}

.empty-state-icon {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pagination-status {
    color: var(--aug-muted);
    font-size: 0.9rem;
}

.stat-number {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--aug-text);
}

/* ─── Directory (cupboards, shopping list): items sorted by section ─── */
.directory-section {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.directory-heading {
    margin-bottom: 0.25rem;
    padding-bottom: 0.15rem;
    border-bottom: 2px solid var(--aug-amber-light);
    font-family: 'Lora', serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aug-taupe);
}

.directory-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.directory-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding-top: 0.35rem;
}

.directory-name {
    color: var(--aug-text);
    text-decoration: none;
}

.directory-name:hover {
    color: var(--aug-amber-dark);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 4px;
}

.directory-quantity {
    min-width: 1.5rem;
    text-align: right;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--aug-amber);
}

.directory-quantity.is-low {
    color: var(--aug-shopping);
}

@media (min-width: 900px) {
    .directory {
        columns: 2;
        column-gap: 3rem;
    }
}

.details {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    margin: 0 0 1rem;
}

.details dt {
    color: var(--aug-taupe);
    font-size: 0.85rem;
    font-weight: 600;
}

.details dd {
    margin: 0;
    font-size: 1.1rem;
}

.details dd.stat-number {
    font-size: 2rem;
    line-height: 1.2;
}

/* ─── Shopping list ─── */
.shopping-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

/* ─── Plain list (label … action) ─── */
.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 1rem;
    border-bottom: 1px solid var(--aug-border);
}

.plain-item:last-child {
    border-bottom: none;
}

/* ─── File drop zone (Symfony UX Dropzone; its own CSS is disabled) ─── */
.dropzone-container {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 8rem;
    margin-bottom: 0.5rem;
    padding: 1.25rem;
    border: 2px dashed var(--aug-amber-light);
    border-radius: 12px;
    background: var(--aug-bg);
    transition: border-color 0.2s ease-out, background 0.2s ease-out;
}

.dropzone-container:hover,
.dropzone-container:focus-within {
    border-color: var(--aug-amber);
    background: #fffaf0;
}

.dropzone-input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-placeholder {
    flex-grow: 1;
    text-align: center;
    color: var(--aug-taupe);
    font-weight: 600;
}

.dropzone-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
}

.dropzone-preview-image {
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 8px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.dropzone-preview-filename {
    overflow-wrap: anywhere;
}

.dropzone-preview-button {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    z-index: 2;
    min-width: var(--aug-touch);
    min-height: var(--aug-touch);
    border: none;
    background: none;
    color: var(--aug-taupe);
    font-size: 1.4rem;
    cursor: pointer;
}

.dropzone-preview-button::before {
    content: '×';
}

/* ─── Receipt check ─── */
.receipt-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--aug-border);
}

.receipt-item:last-of-type {
    border-bottom: none;
}

.receipt-item-name {
    flex: 1 1 12rem;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stepper-button {
    width: var(--aug-touch);
    height: var(--aug-touch);
    border: 1px solid var(--aug-amber-light);
    border-radius: 50%;
    background: var(--aug-bg);
    color: var(--aug-amber-dark);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease-out;
}

.stepper-button:hover {
    background: #fff3e0;
}

.stepper-input {
    width: 3.5rem;
    min-height: var(--aug-touch);
    border: 1px solid var(--aug-border);
    border-radius: 10px;
    text-align: center;
    font: inherit;
    font-weight: 600;
}

.form-actions {
    margin-top: 1.5rem;
}

.dev-details {
    margin-bottom: 1rem;
}

.dev-details pre {
    overflow-x: auto;
    font-size: 0.8rem;
}

/* ─── Augustine's sticky note ─── */
.sticky-note {
    position: relative;
    margin: 1rem 0.25rem 0 0.5rem;
    padding: 1rem 1.25rem 0.5rem;
    background: #fef3c7;
    transform: rotate(-1.2deg);
    box-shadow: 0 6px 14px rgba(120, 80, 10, 0.12);
    line-height: 1.6;
}

/* Washi tape */
.sticky-note::before {
    content: '';
    position: absolute;
    top: -0.7rem;
    left: 50%;
    width: 5.5rem;
    height: 1.4rem;
    transform: translateX(-50%) rotate(2deg);
    background: rgba(217, 119, 6, 0.28);
}

.sticky-note .handwritten {
    font-size: 1.6rem;
    color: #5b4a2e;
}

.signature {
    text-align: right;
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: var(--aug-taupe);
}

/* ─── Recipes ─── */
.recipe > * + * {
    margin-top: 1.5rem;
}

.recipe-title {
    font-family: 'Lora', serif;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--aug-text);
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.recipe-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.recipe-steps li {
    position: relative;
    padding: 0 0 1rem 2.75rem;
    counter-increment: step;
}

.recipe-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--aug-amber-light);
    color: var(--aug-amber-dark);
    font-family: 'Lora', serif;
    font-weight: 600;
}

/* Name ........ value */
.leader-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.leader-list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.leader {
    flex: 1;
    border-bottom: 2px dotted #d6c8ae;
    transform: translateY(-0.3rem);
}

/* ─── Administration ─── */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0 1rem;
}

.filter-form > div {
    flex: 1 1 12rem;
}

.filter-form > div:last-child {
    flex: none;
}

.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.delete-form {
    margin-top: 1.5rem;
    text-align: right;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ─── Long text (legal page) ─── */
.prose section + section {
    margin-top: 2rem;
}

.prose h2 {
    margin-bottom: 0.5rem;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.prose h3 {
    margin-top: 1rem;
    font-weight: 700;
    color: var(--aug-taupe);
}

.prose ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.prose a {
    color: var(--aug-amber);
    font-weight: 600;
}

.prose a:hover {
    color: var(--aug-amber-dark);
}

/* ─── Dictation (voice note to Augustine) ─── */
.dictation-actions {
    margin-top: 0.5rem;
}

.dictation {
    margin-bottom: 2rem;
}

.dictation-status:empty {
    display: none;
}

.dictation-status {
    min-height: 2rem;
    margin-top: 0.25rem;
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    color: var(--aug-voice);
}

/* ─── Footer ─── */
.site-footer {
    padding: 1.5rem 1rem 2rem;
    text-align: center;
    color: var(--aug-muted);
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--aug-taupe);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--aug-amber-dark);
}

@media print {
    .site-header,
    .bookmarks,
    .site-footer,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }
}

/* ─── Top bar ─── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 248, 243, 0.94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--aug-border);
    padding-top: env(safe-area-inset-top);
    font-family: 'Nunito', sans-serif;
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    min-height: 3.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--aug-amber);
    color: white;
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.15rem;
}

.brand-subtitle {
    color: var(--aug-taupe);
    font-weight: 600;
}

.brand-name {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--aug-text);
}

.accent-amber { --accent: var(--aug-amber); }
.accent-manual { --accent: var(--aug-manual); }
.accent-shopping { --accent: var(--aug-shopping); }
.accent-receipt { --accent: var(--aug-receipt); }
.accent-recipe { --accent: var(--aug-recipe); }
.accent-voice { --accent: var(--aug-voice); }

/* ─── User menu ─── */
.user-menu {
    position: relative;
    margin-left: auto;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--aug-touch);
    padding: 0 0.4rem;
    border-radius: 999px;
    color: var(--aug-taupe);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s ease-out;
}

.user-menu-toggle::-webkit-details-marker {
    display: none;
}

.user-menu-toggle:hover,
.user-menu[open] .user-menu-toggle {
    background: var(--aug-bg-secondary);
}

.user-initial {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--aug-amber-light);
    color: var(--aug-amber-dark);
    font-family: 'Lora', serif;
}

.user-name {
    display: none;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 14rem;
    padding: 0.5rem;
    background: white;
    border: 1px solid var(--aug-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(74, 52, 20, 0.12);
    animation: aug-menu-in 0.2s ease-out;
}

@keyframes aug-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-menu-family,
.user-menu-heading {
    margin: 0;
    padding: 0.5rem 0.75rem 0.25rem;
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--aug-amber);
}

.user-menu-heading {
    margin-top: 0.25rem;
    border-top: 1px solid var(--aug-border);
    padding-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--aug-taupe);
}

.user-menu-link {
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 0.75rem;
    border-radius: 8px;
    color: var(--aug-text);
    text-decoration: none;
    transition: background 0.2s ease-out;
}

.user-menu-link:hover {
    background: var(--aug-bg);
}

.user-menu-logout {
    margin-top: 0.25rem;
    border-top: 1px solid var(--aug-border);
    border-radius: 0 0 8px 8px;
    color: var(--aug-taupe);
}

.login-link {
    margin-left: auto;
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 1rem;
    border-radius: 12px;
    background: var(--aug-amber);
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease-out;
}

.login-link:hover {
    background: var(--aug-amber-dark);
}

/* ════════════════════════════════════════════
   THE NOTEBOOK FRAME
   ════════════════════════════════════════════ */

/* The desk the notebook lies on */
body.notebook-desk,
body.cover-desk {
    background: radial-gradient(circle at 20% 0%, #f7f0e3 0%, var(--aug-desk) 70%);
    background-attachment: fixed;
}

.notebook {
    --page-width: 46rem;
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    max-width: var(--page-width);
    margin: 0 auto 2rem;
    /* Own stacking context so the bookmarks can tuck behind the pages.
       No filter/transform here: it would trap the phone's fixed bookmarks inside the notebook. */
    isolation: isolate;
}

.notebook-spread { --page-width: 1100px; }
.notebook-directory { --page-width: 56rem; }
.notebook-card { --page-width: 34rem; }

/* A sheet of paper with the red margin line */
.notebook-page {
    position: relative;
    min-width: 0;
    padding: 1.5rem 1rem 2rem 1.75rem;
    background: var(--aug-paper);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(74, 52, 20, 0.12);
    line-height: 1.6;
}

.notebook-page::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.85rem;
    width: 2px;
    background: var(--aug-margin);
}

/* Open notebook: the two pages stack on phones */
.notebook-spread .notebook-page:first-child {
    border-radius: 12px 12px 0 0;
}

.notebook-spread .notebook-page:nth-child(2) {
    border-radius: 0 0 12px 12px;
    border-top: 1px dashed var(--aug-border);
}

/* Index card: a white bristol card with a red header rule */
.notebook-card .notebook-page {
    background: white;
}

.notebook-card .notebook-page::before {
    display: none;
}

.notebook-card .page-head {
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--aug-margin);
}

/* Inside a page, cards become light sections of the sheet */
.notebook-page .card {
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
}

.notebook-page .card + .card,
.notebook-page .card + section,
.notebook-page section + .card {
    margin-top: 2rem;
}

.notebook-page .card-accent {
    border-left: none; /* the red margin is already there */
}

/* ─── Bookmarks: phones (bottom of the screen) ─── */
.bookmarks {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    height: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom));
    padding: 0 0.4rem env(safe-area-inset-bottom);
    background: linear-gradient(to top, var(--aug-desk) 60%, rgba(239, 231, 216, 0));
}

.bookmark {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    height: 3.4rem;
    border-radius: 10px 10px 0 0;
    background: var(--accent);
    color: white;
    font-family: 'Lora', serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 -2px 6px rgba(74, 52, 20, 0.12);
    transition: height 0.2s ease-out, transform 0.2s ease-out;
}

.bookmark-icon {
    font-size: 1.15rem;
    line-height: 1;
}

/* The open section: the bookmark is the colour of the paper and rises into the page */
.bookmark.is-active {
    height: 4rem;
    background: var(--aug-paper);
    color: var(--aug-text);
    box-shadow: 0 -3px 8px rgba(74, 52, 20, 0.15), inset 0 4px 0 var(--accent);
}

body.has-bookmarks {
    padding-bottom: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom));
}

/* ─── Wide screens: bookmarks on the right edge of the notebook ─── */
@media (min-width: 900px) {
    .notebook {
        padding-right: 2.75rem; /* room for the bookmarks */
        max-width: calc(var(--page-width) + 2.75rem);
    }

    .notebook-page {
        padding: 2rem 2rem 2.5rem 3rem;
        min-height: 36rem;
    }

    .notebook-page::before {
        left: 2rem;
    }

    .notebook-spread {
        grid-template-columns: 1fr 1fr;
    }

    .notebook-spread .notebook-page:first-child {
        border-radius: 12px 0 0 12px;
        box-shadow: inset -18px 0 24px -18px rgba(90, 60, 20, 0.25), 0 12px 24px rgba(74, 52, 20, 0.12); /* binding */
    }

    .notebook-spread .notebook-page:nth-child(2) {
        border-radius: 0 12px 12px 0;
        border-top: none;
        box-shadow: inset 18px 0 24px -18px rgba(90, 60, 20, 0.25), 0 12px 24px rgba(74, 52, 20, 0.12);
    }

    .notebook-card .notebook-page {
        min-height: 0;
        padding-left: 2rem;
    }

    .bookmarks {
        position: absolute;
        top: 3rem;
        right: 0;
        left: auto;
        bottom: auto;
        z-index: -1; /* tucked behind the pages */
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        height: auto;
        padding: 0;
        background: none;
    }

    .bookmark {
        flex: none;
        flex-direction: row;
        gap: 0;
        width: 2.75rem;
        height: auto;
        padding: 1rem 0;
        border-radius: 0 10px 10px 0;
        font-size: 0.85rem;
        writing-mode: vertical-rl;
        box-shadow: 2px 2px 6px rgba(74, 52, 20, 0.12);
    }

    .bookmark:hover {
        transform: translateX(3px);
    }

    .bookmark-icon {
        display: none;
    }

    .bookmark.is-active {
        width: 3.1rem;
        height: auto;
        margin-left: -0.35rem; /* joins the page */
        box-shadow: 2px 2px 6px rgba(74, 52, 20, 0.12), inset -4px 0 0 var(--accent);
    }

    body.has-bookmarks {
        padding-bottom: 0;
    }

    .user-name {
        display: inline;
        padding-right: 0.4rem;
    }

    .site-main {
        padding: 2rem 1.5rem 4rem;
    }
}

/* ════════════════════════════════════════════
   WRITING ON THE PAGE (lists, sections)
   ════════════════════════════════════════════ */
.section-title {
    margin-bottom: 0.25rem;
    font-family: 'Lora', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.notebook-section {
    margin-top: 2rem;
}

.notebook-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notebook-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 2.25rem; /* rows with a link get their touch height from .ink-link */
}

/* Keep "· 15 articles lus" together when the line wraps on small screens */
.notebook-item .muted {
    white-space: nowrap;
}

.checkbox-item {
    justify-content: flex-start;
}

.checkbox-item::before {
    content: '';
    flex: none;
    align-self: center;
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid var(--aug-taupe);
    border-radius: 3px;
    transform: rotate(-3deg);
}

.checkbox-item .handwritten {
    font-size: 1.45rem;
}

.quantity {
    margin-left: auto;
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--aug-shopping);
}

.empty-line {
    color: var(--aug-muted);
    font-style: italic;
}

.moves-day {
    margin-top: 0.75rem;
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--aug-taupe);
    font-size: 0.95rem;
}

/* ════════════════════════════════════════════
   THE COVER (login, sign up)
   ════════════════════════════════════════════ */
.cover {
    position: relative;
    max-width: 26rem;
    margin: 1rem auto 2rem;
    padding: 2.5rem 1.5rem 2rem;
    border-radius: 6px 16px 16px 6px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 6px),
        linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow:
        inset 6px 0 0 rgba(0, 0, 0, 0.12), /* spine */
        0 18px 36px rgba(74, 52, 20, 0.25);
}

/* Elastic strap */
.cover-strap {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 2.25rem;
    width: 0.7rem;
    background: rgba(40, 20, 5, 0.45);
}

.cover-label {
    position: relative;
    margin: 0 auto 1.5rem;
    max-width: 17rem;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    background: var(--aug-paper);
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cover-brand .brand-mark {
    margin: 0 auto 0.4rem;
}

.cover-title {
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--aug-amber-dark);
}

.cover-subtitle {
    margin-top: 0.25rem;
    color: var(--aug-taupe);
    font-style: italic;
    font-size: 0.95rem;
}

.cover-subtitle:empty {
    display: none;
}

.cover-content {
    position: relative;
    padding: 1.5rem 1.25rem;
    border-radius: 10px;
    background: var(--aug-paper);
}

.cover-footer {
    margin-top: 1rem;
    text-align: center;
}

/* ════════════════════════════════════════════
   ADMINISTRATION (outside the notebook)
   ════════════════════════════════════════════ */
.admin-nav {
    border-bottom: 1px solid var(--aug-border);
    background: white;
}

.admin-nav-inner {
    display: flex;
    gap: 0.25rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0.5rem;
    overflow-x: auto;
}

.admin-nav-link {
    flex: none;
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 0.75rem;
    border-bottom: 3px solid transparent;
    color: var(--aug-taupe);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.admin-nav-link:hover {
    color: var(--aug-amber-dark);
}

.admin-nav-link.is-active {
    border-bottom-color: var(--aug-amber);
    color: var(--aug-text);
}

.admin-nav-back {
    margin-left: auto;
    font-weight: 400;
}

/* ─── Statistics (AI consumption) ─── */
.page-wide {
    max-width: 1100px;
}

.kpis {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    margin-top: 1rem;
}

.kpi {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.kpi-label {
    color: var(--aug-taupe);
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-value {
    font-family: 'Lora', serif;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
}

.kpi-detail {
    color: var(--aug-muted);
    font-size: 0.85rem;
}

.kpis + .card,
.card + .kpis,
.breakdown,
.breakdown + .card {
    margin-top: 1rem;
}

.breakdown {
    display: grid;
    gap: 1rem;
}

.breakdown > .card + .card {
    margin-top: 0;
}

.table-note {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.results-heading {
    margin-top: 0.75rem;
    color: var(--aug-taupe);
    font-weight: 700;
}

.members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.members .badge {
    text-decoration: none;
}

.search-form {
    margin-bottom: 1rem;
}

@media (min-width: 900px) {
    .breakdown {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .bookmark,
    .site-header * {
        transition: none !important;
        animation: none !important;
    }
}
