/*
    Project      : AI Writing Tool
    File         : assets/style.css
    Revision     : 1.1.0
    Created      : 2026-06-01
    Updated      : 2026-06-02
    Description  : Responsive layout, split editor panels, buttons, change log styling, and changelog page styling.
*/

:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #68758b;
    --border: #d8deea;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --success: #166534;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --mono: Consolas, Monaco, "Courier New", monospace;
    --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background: radial-gradient(circle at top left, #e0edff, transparent 32rem), var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

button,
select,
textarea {
    font: inherit;
}

button,
select {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
}

button {
    min-height: 42px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover {
    transform: translateY(-1px);
    border-color: #9aa8bf;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

select {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.85rem;
}

.site-header,
.site-footer {
    width: min(1500px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2rem 0 1.25rem;
}

.site-header h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 4rem);
    letter-spacing: -0.06em;
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

.subhead {
    max-width: 68rem;
    margin: 0.5rem 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.header-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.primary-button {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.primary-button:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.danger-button {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #fecaca;
}

.app-shell {
    width: min(1500px, calc(100% - 2rem));
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    grid-template-areas:
        "editor suggestions"
        "changes changes";
    gap: 1rem;
}

.panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(216, 222, 234, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}

.editor-panel {
    grid-area: editor;
    min-height: 650px;
    display: flex;
    flex-direction: column;
}

.suggestions-panel {
    grid-area: suggestions;
    min-height: 650px;
    display: flex;
    flex-direction: column;
}

.changes-panel {
    grid-area: changes;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.panel-header p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    line-height: 1.4;
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    color: var(--muted);
    user-select: none;
}

.toggle-row input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

#draftText {
    width: 100%;
    flex: 1;
    min-height: 460px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--text);
    background: #fbfcff;
    line-height: 1.55;
    outline: none;
}

#draftText:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.85rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.stats-row span {
    padding: 0.35rem 0.65rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.controls-grid {
    min-width: 320px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.controls-grid label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.suggestions-output {
    flex: 1;
    min-height: 420px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfcff;
    overflow: auto;
    line-height: 1.55;
    white-space: pre-wrap;
}

.suggestions-output.loading {
    background-image: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.06), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

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

.button-row {
    margin-top: 0.85rem;
}

.change-log {
    display: grid;
    gap: 0.5rem;
    max-height: 240px;
    overflow: auto;
    margin: 0;
    padding-left: 1.35rem;
}

.change-log li {
    padding: 0.65rem 0.75rem;
    background: #fbfcff;
    border: 1px solid var(--border);
    border-radius: 12px;
    line-height: 1.45;
}

.change-log code {
    font-family: var(--mono);
    font-size: 0.9em;
    color: #334155;
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    color: var(--muted);
    padding: 0 0 2rem;
    font-size: 0.9rem;
}

.site-footer span:not(:last-child)::after {
    content: "•";
    margin-left: 0.75rem;
    color: #94a3b8;
}

.button-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    padding: 0.7rem 1.1rem;
}

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

.site-footer a:hover {
    text-decoration: underline;
}

.changelog-shell {
    display: block;
}

.changelog-panel {
    padding: 1.5rem;
}

.changelog-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.changelog-entry {
    padding: 1rem 1.1rem;
    background: #fbfcff;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.changelog-entry-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.changelog-version {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--accent);
    background: rgba(37, 99, 235, 0.08);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

.changelog-datetime {
    color: var(--muted);
    font-size: 0.88rem;
}

.changelog-summary {
    margin: 0 0 0.55rem;
    line-height: 1.5;
}

.changelog-files {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.changelog-files li + li {
    margin-top: 0.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;
}

@media (max-width: 980px) {
    .site-header {
        align-items: stretch;
        flex-direction: column;
    }

    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "editor"
            "suggestions"
            "changes";
    }

    .editor-panel,
    .suggestions-panel {
        min-height: auto;
    }

    .stacked-mobile,
    .panel-header {
        flex-direction: column;
    }

    .controls-grid {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 620px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .header-actions,
    .button-row {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}
