/**
 * Editor tool styles: hero + spellcheck/rewrite/humanize widget + the
 * "one editor, three tools" section (frontend/modules/editor).
 */

.hero {
    border-bottom: 1px solid var(--pp-color-card-border);
}

.hero__inner {
    padding: 56px 0 64px;
}

.hero__intro {
    position: relative;
    max-width: 640px;
}

.hero__title {
    font-family: var(--pp-font-serif);
    font-weight: 600;
    font-size: clamp(34px, 5vw, 52px);
    line-height: 1.12;
    margin: 0;
}

.hero__title-accent {
    color: var(--pp-color-pen);
}

.hero__sticky-note {
    font-family: var(--pp-font-hand);
    color: var(--pp-color-red);
    font-size: 26px;
    position: absolute;
    right: -8px;
    top: -26px;
    transform: rotate(4deg);
}

.hero__lead {
    color: var(--pp-color-muted);
    font-size: 17px;
    line-height: 1.6;
    margin: 18px 0 0;
    max-width: 520px;
}

/* ─── Editor widget ──────────────────────────────────────────── */
.editor-widget {
    margin-top: 40px;
    background: #fff;
    border: 1px solid var(--pp-color-card-border);
    border-radius: 18px;
    box-shadow: 0 18px 50px -24px rgba(28, 35, 64, .25);
    overflow: hidden;
}

.editor-widget__tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pp-color-card-border);
    flex-wrap: wrap;
}

.mode-tab {
    background: transparent;
    color: var(--pp-color-muted);
    border: none;
    border-radius: 9px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--pp-font-sans);
    cursor: pointer;
}

.mode-tab.is-active {
    background: var(--pp-color-ink);
    color: #fff;
}

.mode-tab__cost {
    opacity: .65;
    margin-left: 6px;
    font-weight: 500;
}

.editor-widget__status {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--pp-color-muted);
    align-self: center;
}

.editor-widget__status.has-errors {
    color: var(--pp-color-red);
    font-weight: 600;
}

.editor-widget__status.is-clean {
    color: var(--pp-color-green);
    font-weight: 600;
}

.editor-widget__status.is-degraded {
    color: #B8860B;
    font-weight: 600;
}

.editor-widget__body {
    padding: 26px 28px;
    font-size: 18px;
    line-height: 1.85;
    font-family: var(--pp-font-serif);
    min-height: 120px;
}

.editor-widget__result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.editor-widget__result-label {
    font-size: 12px;
    font-family: var(--pp-font-sans);
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--pp-color-muted);
    text-transform: uppercase;
}

.editor-widget__result-toggle {
    display: inline-flex;
    background: var(--pp-color-grid);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.editor-widget__result-toggle-btn {
    border: none;
    background: transparent;
    color: var(--pp-color-muted);
    font-family: var(--pp-font-sans);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.editor-widget__result-toggle-btn.is-active {
    background: #fff;
    color: var(--pp-color-ink);
    box-shadow: 0 1px 4px rgba(28, 35, 64, .12);
}

.editor-widget__result-text {
    margin: 0;
}

.editor-widget__changes {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--pp-color-card-border);
}

.editor-widget__changes-title {
    font-size: 12px;
    font-family: var(--pp-font-sans);
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--pp-color-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.editor-widget__changes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--pp-font-sans);
    font-size: 14px;
}

.editor-widget__changes-list li {
    background: var(--pp-color-grid);
    border-radius: 10px;
    padding: 8px 12px;
}

.editor-widget__change-from {
    color: var(--pp-color-red);
    text-decoration: line-through;
}

.editor-widget__change-to {
    color: var(--pp-color-green);
    font-weight: 600;
}

.editor-widget__change-rule {
    color: var(--pp-color-muted);
    font-size: 12.5px;
}

.editor-widget__result-note {
    font-family: var(--pp-font-hand);
    color: var(--pp-color-green);
    font-size: 24px;
    margin-top: 10px;
    transform: rotate(-2deg);
}

.editor-widget__text {
    margin: 0;
}

.editor-widget__textarea-wrap {
    position: relative;
}

.editor-widget__textarea {
    display: block;
    width: 100%;
    min-height: 120px;
    border: none;
    outline: none;
    resize: none; /* replaced by .js-resize-handle — a bigger, touch-friendly grip */
    background: transparent;
    color: var(--pp-color-ink);
    font: inherit;
    line-height: 1.65; /* slightly tighter than the surrounding .editor-widget__body on desktop */
    padding: 0;
}

/* Bigger, easier-to-grab drag handle than the native textarea resizer, especially on touch. */
.editor-widget__resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16px;
    margin-top: 2px;
    cursor: ns-resize;
    touch-action: none;
}

.editor-widget__resize-handle span {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--pp-color-card-border);
    transition: background .15s;
}

.editor-widget__resize-handle:hover span,
.editor-widget__resize-handle.is-dragging span {
    background: var(--pp-color-pen);
}

.js-checked-view .js-edit-again {
    margin-top: 16px;
}

.err-word {
    text-decoration: underline wavy var(--pp-color-red) 2px;
    text-underline-offset: 5px;
    cursor: pointer;
    transition: color .2s;
}

.err-word:hover {
    color: var(--pp-color-red);
}

.fixed-word {
    color: var(--pp-color-green);
    font-weight: 600;
}

.editor-widget__ai-error {
    margin: 0 28px 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(224, 62, 54, .08);
    color: var(--pp-color-red);
    font-size: 13.5px;
    font-weight: 600;
}

.editor-widget__counters {
    display: flex;
    gap: 20px;
    padding: 10px 28px;
    border-top: 1px dashed var(--pp-color-card-border);
    font-size: 12.5px;
    color: var(--pp-color-muted);
    flex-wrap: wrap;
    font-family: var(--pp-font-sans);
}

.editor-widget__counters b {
    color: var(--pp-color-ink);
    font-weight: 600;
}

.editor-widget__estimate {
    margin-left: auto;
    color: var(--pp-color-pen-dark);
    font-weight: 600;
}

.editor-widget__actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--pp-color-card-border);
    background: var(--pp-color-paper);
    flex-wrap: wrap;
    align-items: center;
}

.editor-widget__actions .js-actions-edit,
.editor-widget__actions .js-actions-done {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-widget__hint {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--pp-color-muted);
}

/* ─── "One editor, three tools" section ──────────────────────── */
.tools {
    padding: 64px 0;
}

.tools__title {
    font-family: var(--pp-font-serif);
    font-weight: 600;
    font-size: 30px;
    margin: 0 0 6px;
}

.tools__subtitle {
    color: var(--pp-color-muted);
    margin: 0 0 28px;
    font-size: 15.5px;
}

.tools__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.tool-card {
    background: #fff;
    border: 1px solid var(--pp-color-card-border);
    border-radius: 16px;
    padding: 22px 22px 20px;
}

.tool-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.tool-card__name {
    font-family: var(--pp-font-serif);
    font-weight: 600;
    font-size: 20px;
}

.tool-card__desc {
    color: var(--pp-color-muted);
    font-size: 14.5px;
    line-height: 1.6;
    margin: 10px 0 0;
}

@media (max-width: 820px) {
    .editor-widget__textarea {
        line-height: 2.05; /* roomier for touch typing/reading than the desktop value */
    }

    .editor-widget__resize-handle {
        height: 30px; /* bigger touch target for dragging on mobile */
        margin-top: 4px;
    }

    .editor-widget__resize-handle span {
        width: 48px;
        height: 5px;
    }
}
