/* =============================================================
   MyDaily - Ana stil dosyası
   Tema değişkenleri + bileşenler
   ============================================================= */

/* -------------------------------------------------------------
   1. Tema değişkenleri
   ------------------------------------------------------------- */
:root {
    --base-size: 16px;
    --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --container: 1120px;
    --transition: 180ms ease;

    --success: #2f7d5a;
    --danger: #b3453b;
}

html {
    font-size: var(--base-size, 16px);
}

/* Yazi tipi onizlemesi (data-font) */
[data-font='inter'] { --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
[data-font='lora'] { --font-main: 'Lora', Georgia, 'Times New Roman', serif; }
[data-font='dancing'] { --font-main: 'Dancing Script', 'Brush Script MT', cursive; }
[data-font='courier'] { --font-main: 'Courier Prime', 'Courier New', monospace; }

[data-theme='light'] {
    color-scheme: light;
    --bg: #f6f3ee;
    --bg-soft: #efe9e0;
    --surface: #fffdfa;
    --surface-2: #f7f2ea;
    --text: #2b2823;
    --heading: #1f1c18;
    --muted: #7b7367;
    --border: #e8e1d6;
    --border-strong: #d9cfc0;
    --accent: #b9613a;
    --accent-hover: #9f5030;
    --accent-contrast: #fff8f3;
    --accent-soft: #f7e7dc;
    --danger-soft: #fbeae7;
    --success-soft: #e7f4ed;
    --shadow: 0 1px 2px rgba(43, 40, 35, 0.04), 0 18px 40px -28px rgba(43, 40, 35, 0.35);
    --header-bg: rgba(246, 243, 238, 0.86);
    --ring: rgba(185, 97, 58, 0.28);

    /* Defter kâğıdı */
    --paper: #fcf7e8;
    --paper-ink: #33302a;
    --paper-rule: rgba(96, 132, 178, 0.30);
    --paper-margin-line: rgba(186, 82, 65, 0.42);
    --paper-edge: #e7dcc3;
    --paper-foxing: rgba(140, 96, 48, 0.12);
}

[data-theme='dark'] {
    color-scheme: dark;
    --bg: #16151a;
    --bg-soft: #1d1c22;
    --surface: #201f26;
    --surface-2: #28262f;
    --text: #e9e5de;
    --heading: #f6f2ea;
    --muted: #a0988d;
    --border: #322f38;
    --border-strong: #423e4a;
    --accent: #e2916a;
    --accent-hover: #eea481;
    --accent-contrast: #221610;
    --accent-soft: #3a2a22;
    --danger-soft: #3b2320;
    --success-soft: #1e3429;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 22px 48px -30px rgba(0, 0, 0, 0.9);
    --header-bg: rgba(22, 21, 26, 0.85);
    --ring: rgba(226, 145, 106, 0.35);

    /* Defter kâğıdı */
    --paper: #23262d;
    --paper-ink: #e8e3d8;
    --paper-rule: rgba(148, 174, 210, 0.20);
    --paper-margin-line: rgba(214, 120, 101, 0.35);
    --paper-edge: #343842;
    --paper-foxing: rgba(226, 198, 156, 0.06);
}

[data-theme='sepia'] {
    color-scheme: light;
    --bg: #f2e6d2;
    --bg-soft: #ebdcc3;
    --surface: #fbf3e3;
    --surface-2: #f4e8d2;
    --text: #463624;
    --heading: #392b1b;
    --muted: #8a7357;
    --border: #e3d1b3;
    --border-strong: #d3bd97;
    --accent: #a26233;
    --accent-hover: #8a5027;
    --accent-contrast: #fff8ec;
    --accent-soft: #f0dfc4;
    --danger-soft: #f6e2da;
    --success-soft: #e7eeda;
    --shadow: 0 1px 2px rgba(70, 54, 36, 0.05), 0 18px 40px -28px rgba(70, 54, 36, 0.4);
    --header-bg: rgba(242, 230, 210, 0.87);
    --ring: rgba(162, 98, 51, 0.28);

    /* Defter kâğıdı */
    --paper: #f8edd6;
    --paper-ink: #43331f;
    --paper-rule: rgba(139, 108, 68, 0.26);
    --paper-margin-line: rgba(160, 80, 55, 0.40);
    --paper-edge: #e2cfab;
    --paper-foxing: rgba(120, 82, 40, 0.14);
}

[data-theme='pastel'] {
    color-scheme: light;
    --bg: #f4f0fb;
    --bg-soft: #ece6f8;
    --surface: #fffdfe;
    --surface-2: #f6f1fb;
    --text: #3c3450;
    --heading: #2f2742;
    --muted: #837a96;
    --border: #e8dff5;
    --border-strong: #d8cbee;
    --accent: #8064c8;
    --accent-hover: #6d52b5;
    --accent-contrast: #fdfbff;
    --accent-soft: #ece3fb;
    --danger-soft: #fbe9ef;
    --success-soft: #e6f2f2;
    --shadow: 0 1px 2px rgba(60, 52, 80, 0.05), 0 18px 40px -28px rgba(60, 52, 80, 0.35);
    --header-bg: rgba(244, 240, 251, 0.87);
    --ring: rgba(128, 100, 200, 0.28);

    /* Defter kâğıdı */
    --paper: #fdf9ff;
    --paper-ink: #3c3450;
    --paper-rule: rgba(139, 127, 190, 0.22);
    --paper-margin-line: rgba(178, 109, 160, 0.33);
    --paper-edge: #e6dcf2;
    --paper-foxing: rgba(128, 108, 160, 0.10);
}

/* -------------------------------------------------------------
   2. Temel
   ------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image:
        radial-gradient(42rem 30rem at 8% -10%, var(--accent-soft), transparent 65%),
        radial-gradient(36rem 26rem at 100% 0%, var(--bg-soft), transparent 60%);
    background-repeat: no-repeat;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.65;
    letter-spacing: 0.005em;
    transition: background-color var(--transition), color var(--transition);
}

h1, h2, h3, h4 {
    color: var(--heading);
    font-family: var(--font-main);
    line-height: 1.25;
    margin: 0 0 0.5em;
    letter-spacing: -0.015em;
}

h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 650; }

p { margin: 0 0 1rem; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover { color: var(--accent-hover); }

svg { display: block; }

:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
    border-radius: 4px;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -60px;
    z-index: 100;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    transition: top var(--transition);
}

.skip-link:focus {
    top: 1rem;
    color: var(--accent-contrast);
}

.eyebrow {
    display: inline-block;
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* -------------------------------------------------------------
   3. Header & navigasyon
   ------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.5rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--heading);
}

.brand:hover { color: var(--heading); }

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    flex: none;
    border-radius: 14px;
    background: var(--accent);
    color: var(--accent-contrast);
    box-shadow: 0 8px 18px -10px var(--accent);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
}

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

.nav-link {
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 550;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 650;
}

.nav-account {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 0.5rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--border);
}

.nav-email {
    max-width: 13rem;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-form { margin: 0; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------------------------------------------------
   4. Butonlar
   ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.72rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition),
                color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
    box-shadow: 0 10px 24px -14px var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--accent-contrast);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #9c3a31;
    color: #fff;
}

.btn-danger-ghost {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.btn-danger-ghost:hover {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
}

.btn-block { width: 100%; }

/* -------------------------------------------------------------
   5. Flash & uyarılar
   ------------------------------------------------------------- */
.flash-stack {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

.flash {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.92rem;
    box-shadow: var(--shadow);
}

.flash p { margin: 0; flex: 1; }

.flash-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.flash--success .flash-icon {
    background: var(--success-soft);
    color: var(--success);
}

.flash--error .flash-icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.flash--info .flash-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.flash-close {
    flex: none;
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.flash-close:hover { background: var(--surface-2); color: var(--text); }

.alert {
    margin-bottom: 1.25rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.alert ul {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.2rem;
}

.alert--error {
    background: var(--danger-soft);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    color: var(--danger);
}

/* -------------------------------------------------------------
   6. Ana gövde & footer
   ------------------------------------------------------------- */
.site-main {
    flex: 1;
    padding: clamp(1.5rem, 4vw, 2.75rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.75rem 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.footer-inner p { margin: 0; }
.footer-brand { color: var(--heading); font-weight: 700; }
.footer-copy { font-size: 0.78rem; }

/* -------------------------------------------------------------
   7. Sayfa başlıkları
   ------------------------------------------------------------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.page-head-text { max-width: 46rem; }

.page-head h1 { margin-bottom: 0.35rem; }

.page-head--compact { margin-bottom: 1.5rem; }

.page-lead {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.page-lead strong { color: var(--text); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* -------------------------------------------------------------
   8. Panel & filtreler
   ------------------------------------------------------------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.filter-panel {
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.search-field {
    position: relative;
    flex: 1 1 16rem;
}

.search-field input {
    width: 100%;
    padding-left: 2.6rem;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.select-field { flex: 0 1 11rem; }

.select-field select { width: 100%; }

.filter-summary {
    margin: 0.85rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.mood-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-pill);
    background: rgb(var(--mood-hue, 130 125 115) / 0.14);
    color: var(--text);
    font-size: 0.8rem;
}

/* -------------------------------------------------------------
   9. Form alanları
   ------------------------------------------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
}

.field label,
.field legend {
    color: var(--heading);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0;
}

.field legend { margin-bottom: 0.55rem; }

fieldset.field {
    border: 0;
    padding: 0;
    margin-inline: 0;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='date'],
select,
textarea {
    width: 100%;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

input::placeholder,
textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

textarea {
    resize: vertical;
    min-height: 9rem;
}

select {
    appearance: none;
    padding-right: 2.4rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.85rem) 55%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
    border-color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 550;
}

.field-hint {
    color: var(--muted);
    font-size: 0.78rem;
}

.field-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.char-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.char-count.is-near-limit {
    color: var(--danger);
    font-weight: 600;
}

/* Mikrofonla yazma */
.field-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
}

.mic-button {
    gap: 0.4rem;
    min-height: 2.75rem;
    border-radius: var(--radius-pill);
}

.mic-button.is-listening {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}

.mic-button.is-listening span[aria-hidden='true'] {
    animation: mic-pulse 1.1s ease-in-out infinite;
}

.dictation-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.dictation-status.is-error { color: var(--danger); }

@keyframes mic-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.55; transform: scale(0.88); }
}

.input-with-action { position: relative; }

.input-with-action input { padding-right: 5rem; }

.input-action {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    padding: 0.35rem 0.6rem;
    border: 0;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.input-action:hover { color: var(--text); }

/* -------------------------------------------------------------
   10. Auth sayfaları
   ------------------------------------------------------------- */
.page-auth .site-main { padding-top: clamp(1.75rem, 5vw, 3.5rem); }

.auth-wrap {
    display: grid;
    grid-template-columns: 1.05fr minmax(0, 460px);
    align-items: center;
    gap: clamp(1.5rem, 5vw, 4rem);
}

.auth-aside { max-width: 34rem; }

.auth-title {
    font-size: clamp(2rem, 4.4vw, 3.1rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.auth-lead {
    color: var(--muted);
    font-size: 1rem;
    max-width: 30rem;
}

.auth-points {
    display: grid;
    gap: 0.55rem;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.auth-points li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-size: 0.9rem;
}

.auth-points span {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    flex: none;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.auth-quote {
    margin: 1.75rem 0 0;
    padding-left: 1rem;
    border-left: 3px solid var(--accent);
    color: var(--muted);
    font-size: 0.92rem;
    font-style: italic;
}

.auth-card {
    padding: clamp(1.5rem, 3vw, 2.25rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.auth-card-head { margin-bottom: 1.4rem; }

.auth-card-head h2 {
    margin-bottom: 0.25rem;
    font-size: 1.45rem;
}

.auth-card-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-switch {
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

.auth-switch a { font-weight: 600; }

/* -------------------------------------------------------------
   11. Günlük listesi
   ------------------------------------------------------------- */
.list-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.4rem;
    margin: 0 0 0.9rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.list-order { color: var(--muted); }

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

/* Liste kartları: küçük defter sayfaları */
.entry-card {
    --card-margin-x: 1.85rem;
    --card-pad-left: 2.75rem;

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.35rem 1.35rem 1.25rem var(--card-pad-left);
    background-color: var(--paper);
    background-image:
        linear-gradient(
            to right,
            transparent 0 calc(var(--card-margin-x) - 1px),
            var(--paper-margin-line) calc(var(--card-margin-x) - 1px) var(--card-margin-x),
            transparent var(--card-margin-x)
        ),
        radial-gradient(circle 1.5px at 14% 68%, var(--paper-foxing) 0 55%, transparent 100%),
        radial-gradient(ellipse 5px 3px at 83% 24%, var(--paper-foxing) 0 50%, transparent 100%),
        radial-gradient(circle 2px at 62% 84%, var(--paper-foxing) 0 55%, transparent 100%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 55%),
        repeating-linear-gradient(0deg, rgba(120, 96, 60, 0.014) 0 1px, transparent 1px 4px);
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 4px;
    border: 1px solid var(--paper-edge);
    border-radius: 8px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        inset 0 0 26px color-mix(in srgb, var(--paper-ink) 7%, transparent),
        0 2px 4px rgba(60, 45, 25, 0.05),
        0 18px 36px -32px rgba(60, 45, 25, 0.5);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* Yıpranmış kâğıt kenarı: ince, düzensiz lif dokusu.
   Maske desteği yoksa doku hiç çizilmez (metnin üstünü kaplamasın). */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
    .entry-card::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 1;
        padding: 1px;
        border-radius: inherit;
        background:
            repeating-linear-gradient(
                90deg,
                var(--paper-ink) 0 4px,
                transparent 4px 9px,
                var(--paper-ink) 9px 13px
            ),
            repeating-linear-gradient(
                0deg,
                var(--paper-ink) 0 5px,
                transparent 5px 11px
            );
        opacity: 0.14;
        pointer-events: none;
        -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
        mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
        mask-composite: exclude;
    }
}

/* Sağ üstte kıvrılmış köşe */
.entry-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: 1.3rem;
    height: 1.3rem;
    border-top-right-radius: 7px;
    background:
        linear-gradient(
            225deg,
            transparent 0 calc(50% - 2px),
            rgba(70, 50, 30, 0.16) calc(50% - 2px) 50%,
            transparent 50%
        ),
        linear-gradient(
            225deg,
            color-mix(in srgb, var(--paper-ink) 11%, var(--paper)) 0 50%,
            transparent 50%
        );
    filter: drop-shadow(-1px 1px 1px rgba(40, 28, 15, 0.22));
    pointer-events: none;
}

/* Küçük yırtık dilleri: kenarlık çizgisini yerel olarak keser */
.entry-card-torn {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.entry-card-torn::before,
.entry-card-torn::after {
    content: '';
    position: absolute;
    background: var(--paper);
}

/* Alt kenarda küçük bir yırtık */
.entry-card-torn::before {
    left: 14%;
    bottom: -4px;
    width: 4.2rem;
    height: 9px;
    clip-path: polygon(
        0 0, 100% 0, 96% 40%, 100% 64%, 88% 100%, 77% 52%, 63% 86%,
        51% 55%, 35% 100%, 23% 60%, 11% 88%, 4% 46%, 0 72%
    );
    filter: drop-shadow(0 2px 2px rgba(60, 45, 25, 0.25));
}

/* Sağ kenarda küçük bir yırtık */
.entry-card-torn::after {
    top: 46%;
    right: -3px;
    width: 8px;
    height: 2.5rem;
    clip-path: polygon(
        0 0, 100% 6%, 55% 18%, 100% 32%, 48% 50%, 96% 64%, 52% 80%,
        100% 94%, 0 100%
    );
    filter: drop-shadow(-2px 0 2px rgba(60, 45, 25, 0.2));
}

/* Yırtıklar karta gelince kâğıt gibi hafifçe salınır */
.entry-card-torn::before { transform-origin: 50% 0; }
.entry-card-torn::after { transform-origin: 0 50%; }

.entry-card:hover .entry-card-torn::before {
    animation: tear-sway-bottom 3.4s ease-in-out infinite;
}

.entry-card:hover .entry-card-torn::after {
    animation: tear-sway-right 2.9s ease-in-out infinite;
}

@keyframes tear-sway-bottom {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    35%      { transform: rotate(-2.2deg) translateY(1.4px); }
    70%      { transform: rotate(1.2deg) translateY(0.5px); }
}

@keyframes tear-sway-right {
    0%, 100% { transform: rotate(0deg) translateX(0); }
    40%      { transform: rotate(2.8deg) translateX(1.4px); }
    75%      { transform: rotate(-1.4deg) translateX(0.5px); }
}

/* Dokunmatikte tek seferlik kısa salınım */
.entry-card.is-tapped .entry-card-torn::before {
    animation: tear-tap-bottom 0.9s ease-out 1;
}

.entry-card.is-tapped .entry-card-torn::after {
    animation: tear-tap-right 0.8s ease-out 1;
}

@keyframes tear-tap-bottom {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    22%      { transform: rotate(-3.4deg) translateY(1.8px); }
    48%      { transform: rotate(2.1deg) translateY(0.9px); }
    74%      { transform: rotate(-1deg) translateY(0.4px); }
}

@keyframes tear-tap-right {
    0%, 100% { transform: rotate(0deg) translateX(0); }
    26%      { transform: rotate(3.4deg) translateX(1.8px); }
    54%      { transform: rotate(-1.8deg) translateX(0.7px); }
    78%      { transform: rotate(0.9deg) translateX(0.3px); }
}

.entry-card:hover {
    transform: translateY(-2px);
    border-color: var(--paper-margin-line);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        inset 0 0 26px color-mix(in srgb, var(--paper-ink) 8%, transparent),
        0 3px 6px rgba(60, 45, 25, 0.07),
        0 22px 42px -32px rgba(60, 45, 25, 0.55);
}

.entry-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.entry-tags {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.media-count {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.entry-date {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mood-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex: none;
    padding: 0.18rem 0.6rem;
    border: 1px solid rgb(var(--mood-hue, 130 125 115) / 0.28);
    border-radius: var(--radius-pill);
    background: rgb(var(--mood-hue, 130 125 115) / 0.12);
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.mood--mutlu     { --mood-hue: 201 138 30; }
.mood--huzunlu   { --mood-hue: 79 124 191; }
.mood--sakin     { --mood-hue: 76 148 118; }
.mood--enerjik   { --mood-hue: 214 96 54; }
.mood--heyecanli { --mood-hue: 176 88 156; }
.mood--yorgun    { --mood-hue: 120 113 137; }
.mood--diger     { --mood-hue: 130 125 115; }

.entry-title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.entry-title a {
    color: var(--heading);
    display: inline-block;
}

.entry-title a:hover { color: var(--accent); }

.entry-excerpt {
    --rule: 1.55rem;

    margin: 0;
    padding-bottom: 0.15rem;
    color: color-mix(in srgb, var(--paper-ink) 70%, transparent);
    font-size: 0.92rem;
    line-height: var(--rule);
    white-space: pre-line;
    overflow-wrap: anywhere;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0 calc(var(--rule) - 1px),
        var(--paper-rule) calc(var(--rule) - 1px) var(--rule)
    );
    background-repeat: repeat;
    background-size: 100% var(--rule);
    /* Çizgiler metin taban çizgisine denk gelsin. */
    background-position: 0 calc(var(--rule) * -0.28);
}

.entry-card .btn-ghost {
    color: color-mix(in srgb, var(--paper-ink) 68%, transparent);
}

.entry-card .btn-ghost:hover {
    background: color-mix(in srgb, var(--paper-ink) 8%, transparent);
    color: var(--paper-ink);
}

.entry-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--paper-edge);
}

.entry-meta {
    color: var(--muted);
    font-size: 0.72rem;
}

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

.entry-actions form { margin: 0; }

.empty-state {
    display: grid;
    justify-items: center;
    gap: 0.4rem;
    padding: clamp(2rem, 6vw, 4rem) 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    text-align: center;
}

.empty-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.empty-state h2 { margin: 0; }
.empty-state p {
    max-width: 30rem;
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 1.75rem;
    font-size: 0.86rem;
}

.page-link {
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    font-weight: 550;
}

a.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-link.is-disabled {
    color: var(--muted);
    opacity: 0.6;
    cursor: not-allowed;
}

.page-status { color: var(--muted); }
.page-status strong { color: var(--text); }

/* -------------------------------------------------------------
   11b. Okuma görünümü (tam metin)
   ------------------------------------------------------------- */
/* Çizgili defter kâğıdı görünümü */
.reader {
    max-width: 48rem;
    margin: 0 auto;
    padding: clamp(1.4rem, 4vw, 2.5rem);
    border: 1px solid var(--paper-edge);
    border-radius: 8px;
    background-color: var(--paper);
    background-image:
        linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 55%),
        repeating-linear-gradient(0deg, rgba(120, 96, 60, 0.016) 0 1px, transparent 1px 4px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 2px 4px rgba(60, 45, 25, 0.06),
        0 30px 60px -42px rgba(60, 45, 25, 0.5);
}

.reader-head {
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--paper-edge);
}

.reader-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.reader-title {
    margin: 0 0 0.55rem;
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.reader-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.reader-body {
    --rule: 2rem;
    --margin-x: 2.35rem;
    --text-indent: 2.85rem;

    padding: 0 0 0.4rem var(--text-indent);
    color: var(--paper-ink);
    font-size: 1rem;
    line-height: var(--rule);
    white-space: pre-line;
    overflow-wrap: anywhere;
    background-image:
        linear-gradient(
            to right,
            transparent 0 calc(var(--margin-x) - 1px),
            var(--paper-margin-line) calc(var(--margin-x) - 1px) var(--margin-x),
            transparent var(--margin-x)
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0 calc(var(--rule) - 1px),
            var(--paper-rule) calc(var(--rule) - 1px) var(--rule)
        );
    background-repeat: no-repeat, repeat;
    background-size: 100% 100%, 100% var(--rule);
    /* Çizgiler metin taban çizgisine denk gelsin. */
    background-position: 0 0, 0 calc(var(--rule) * -0.3);
}

.reader .reader-title { color: var(--paper-ink); }

.reader-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--paper-edge);
}

.reader-foot form { margin: 0; }

/* Okuma sayfasındaki medyalar */
.reader-media {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.media-grid {
    display: grid;
    gap: 0.75rem;
}

.media-grid--images {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.media-grid--video { grid-template-columns: 1fr; }

.media-image {
    display: block;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.media-image img {
    display: block;
    width: 100%;
    max-height: 30rem;
    object-fit: contain;
    background: var(--surface-2);
    transition: transform var(--transition);
}

.media-image:hover img { transform: scale(1.015); }

.media-video { margin: 0; }

.media-video video {
    display: block;
    width: 100%;
    max-height: 32rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #000;
}

.media-video figcaption {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.media-audio-list {
    display: grid;
    gap: 0.65rem;
}

.media-audio {
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.media-audio-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.media-audio audio {
    display: block;
    width: 100%;
}

/* -------------------------------------------------------------
   12. Editör (yeni / düzenle)
   ------------------------------------------------------------- */
.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
    align-items: start;
    gap: 1.25rem;
}

.editor-main { padding: clamp(1.15rem, 3vw, 1.75rem); }

.editor-main .field:last-child { margin-bottom: 0; }

.label-optional {
    color: var(--muted);
    font-weight: 500;
}

.field-label {
    color: var(--heading);
    font-size: 0.85rem;
    font-weight: 600;
}

.file-field input[type='file'] {
    width: 100%;
    padding: 0.6rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.file-field input[type='file']:hover { border-color: var(--accent); }

.file-field input[type='file']::file-selector-button {
    margin-right: 0.7rem;
    padding: 0.5rem 0.9rem;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.media-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.media-edit-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: 'thumb meta' 'thumb remove';
    align-items: center;
    gap: 0.35rem 0.6rem;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.media-edit-item img,
.media-edit-icon {
    grid-area: thumb;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    object-fit: cover;
}

.media-edit-icon {
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}

.media-edit-meta {
    grid-area: meta;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.media-edit-name {
    font-size: 0.78rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-edit-meta small {
    color: var(--muted);
    font-size: 0.7rem;
}

.media-remove {
    grid-area: remove;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.media-remove input { accent-color: var(--danger); }

.editor-main textarea {
    min-height: 18rem;
    line-height: 1.75;
}

/* Yazarken çizgili defter sayfası */
.notebook-input {
    --rule: 1.85rem;
    --margin-x: 1.95rem;
    --text-indent: 2.4rem;

    padding: 0.55rem 0.9rem 0.55rem var(--text-indent);
    border-color: var(--paper-edge);
    color: var(--paper-ink);
    line-height: var(--rule);
    caret-color: var(--accent);
    background-color: var(--paper);
    background-image:
        linear-gradient(
            to right,
            transparent 0 calc(var(--margin-x) - 1px),
            var(--paper-margin-line) calc(var(--margin-x) - 1px) var(--margin-x),
            transparent var(--margin-x)
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0 calc(var(--rule) - 1px),
            var(--paper-rule) calc(var(--rule) - 1px) var(--rule)
        );
    background-repeat: no-repeat, repeat;
    background-attachment: scroll, local;
    background-size: 100% 100%, 100% var(--rule);
}

.notebook-input::placeholder {
    color: color-mix(in srgb, var(--paper-ink) 45%, transparent);
}

/* Editördeki genel line-height kuralını geçersiz kılar ve çizgileri metne hizalar. */
.editor-main .notebook-input {
    line-height: var(--rule);
    background-position: 0 0, 0 calc(0.55rem - var(--rule) * 0.3);
}

.editor-side {
    position: sticky;
    top: 5.5rem;
    display: grid;
    gap: 1rem;
}

.side-card { padding: 1.25rem; }

.side-title {
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.mood-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.mood-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition);
}

.mood-option:hover { border-color: var(--border-strong); }

.mood-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mood-emoji { font-size: 1rem; line-height: 1; }

.mood-option:has(input:checked) {
    border-color: rgb(var(--mood-hue) / 0.75);
    background: rgb(var(--mood-hue) / 0.14);
    font-weight: 650;
}

.mood-option:has(input:focus-visible) {
    outline: 3px solid var(--ring);
    outline-offset: 1px;
}

.side-actions {
    display: grid;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.tip-card,
.danger-card {
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    font-size: 0.84rem;
}

.danger-card {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 22%, transparent);
}

.tip-card p,
.danger-card p { margin: 0 0 0.5rem; color: var(--text); }

.danger-card form { margin: 0; }

.tip-title {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* -------------------------------------------------------------
   13. Silme onayı
   ------------------------------------------------------------- */
.confirm-card {
    max-width: 42rem;
    margin: clamp(1rem, 4vw, 3rem) auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.confirm-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.confirm-card h1 {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    margin-bottom: 0.5rem;
}

.confirm-lead {
    max-width: 30rem;
    margin: 0 auto 1.5rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.confirm-preview {
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: left;
}

.confirm-date {
    margin: 0 0 0.3rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.confirm-preview h2 { margin-bottom: 0.4rem; font-size: 1.1rem; }

.confirm-preview p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.confirm-actions form { margin: 0; }

/* -------------------------------------------------------------
   14. Ayarlar
   ------------------------------------------------------------- */
.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
    align-items: start;
    gap: 1.25rem;
}

.settings-main {
    display: grid;
    gap: 1rem;
}

.settings-panel { padding: clamp(1.15rem, 3vw, 1.6rem); }

.panel-head { margin-bottom: 1.1rem; }

.panel-head h2 { margin-bottom: 0.2rem; font-size: 1.1rem; }

.panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.theme-card,
.font-card,
.size-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.theme-card:hover,
.font-card:hover,
.size-card:hover { border-color: var(--border-strong); }

.theme-card input,
.font-card input,
.size-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.theme-card:has(input:checked),
.font-card:has(input:checked),
.size-card:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.theme-card:has(input:focus-visible),
.font-card:has(input:focus-visible),
.size-card:has(input:focus-visible) {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 5px;
    height: 4.2rem;
    padding: 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.swatch-dot {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
}

.swatch-line {
    display: block;
    height: 4px;
    border-radius: 3px;
    opacity: 0.65;
}

.swatch-line--short { width: 55%; }

.theme-swatch--light { background: #f6f3ee; }
.theme-swatch--light .swatch-dot { background: #b9613a; }
.theme-swatch--light .swatch-line { background: #c9c0b2; }

.theme-swatch--dark { background: #201f26; }
.theme-swatch--dark .swatch-dot { background: #e2916a; }
.theme-swatch--dark .swatch-line { background: #4a4652; }

.theme-swatch--sepia { background: #f2e6d2; }
.theme-swatch--sepia .swatch-dot { background: #a26233; }
.theme-swatch--sepia .swatch-line { background: #cbb28a; }

.theme-swatch--pastel { background: #f4f0fb; }
.theme-swatch--pastel .swatch-dot { background: #8064c8; }
.theme-swatch--pastel .swatch-line { background: #cfc2e8; }

.theme-name {
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.font-card {
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem;
}

.font-sample {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex: none;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--heading);
    font-size: 1.35rem;
    line-height: 1;
}

.font-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.font-name { font-weight: 650; font-size: 0.9rem; }
.font-desc { color: var(--muted); font-size: 0.74rem; }

.size-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.size-card {
    flex-direction: row;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem;
}

.size-sample {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    flex: none;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--heading);
    font-weight: 600;
    line-height: 1;
}

.size-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.size-name { font-size: 0.85rem; font-weight: 600; }
.size-value { color: var(--muted); font-size: 0.72rem; }

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    padding-top: 0.25rem;
}

.save-hint {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.settings-side {
    position: sticky;
    top: 5.5rem;
    display: grid;
    gap: 1rem;
}

.preview-panel { padding: 1.25rem; }

.preview-entry {
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.preview-date {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.preview-entry h3 { margin-bottom: 0.35rem; font-size: 1.05rem; }

.preview-entry p {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.preview-cta {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.account-panel { padding: 1.25rem; }

.account-list {
    display: grid;
    gap: 0.7rem;
    margin: 0 0 0.9rem;
}

.account-list div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.account-list dt {
    color: var(--muted);
    font-size: 0.78rem;
}

.account-list dd {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.account-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.5;
}

/* -------------------------------------------------------------
   15. Duyarlı tasarım
   ------------------------------------------------------------- */
@media (max-width: 1000px) {
    .auth-wrap {
        grid-template-columns: 1fr;
        max-width: 34rem;
        margin: 0 auto;
    }

    .auth-aside { display: none; }

    .editor-layout,
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .editor-side,
    .settings-side {
        position: static;
    }
}

@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.2rem;
        padding: 0.9rem clamp(1rem, 4vw, 2rem) 1.1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

    .site-nav.is-open { display: flex; }

    .site-nav--guest {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .nav-link { padding: 0.7rem 0.85rem; }

    .nav-account {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin: 0.5rem 0 0;
        padding: 0.75rem 0 0;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .nav-email {
        max-width: none;
        padding: 0 0.85rem;
    }

    .logout-form .btn { width: 100%; }

    .entry-grid { grid-template-columns: 1fr; }

    .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 540px) {
    .reader { padding: 1.15rem 0.9rem 1.4rem; }

    .reader-body {
        --rule: 1.9rem;
        --margin-x: 1.6rem;
        --text-indent: 2.05rem;
    }

    .notebook-input {
        --rule: 1.8rem;
        --margin-x: 1.5rem;
        --text-indent: 1.9rem;
    }

    .entry-card {
        --card-margin-x: 1.55rem;
        --card-pad-left: 2.35rem;
        padding-right: 1.1rem;
    }

    .page-head { align-items: flex-start; }

    .page-head .btn { width: 100%; }

    .filter-bar > .btn,
    .filter-bar > .select-field { flex: 1 1 100%; }

    .font-grid { grid-template-columns: 1fr; }

    .size-grid { grid-template-columns: 1fr; }

    .entry-foot { flex-direction: column; align-items: flex-start; }

    .reader-foot { flex-direction: column; align-items: stretch; }

    .media-edit-grid { grid-template-columns: 1fr; }

    .entry-actions {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: 0.45rem;
        width: 100%;
    }
    .entry-actions .btn {
        width: 100%;
        min-height: 2.75rem;
        padding-block: 0.6rem;
    }

    input[type='text'],
    input[type='email'],
    input[type='password'],
    input[type='search'],
    input[type='date'],
    select,
    textarea {
        /* iOS Safari 16px altındaki alanlarda sayfayı yakınlaştırır. */
        font-size: 1rem;
    }

    .pagination { flex-wrap: wrap; gap: 0.5rem; }

    .confirm-actions { flex-direction: column; }
    .confirm-actions .btn,
    .confirm-actions form,
    .confirm-actions form .btn { width: 100%; }

    .settings-actions .btn { width: 100%; }
}

/* -------------------------------------------------------------
   16. Erişilebilirlik / hareket azaltma
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
