/* ==========================================================================
   ReplyFlow design system
   Modern neo-brutalism: warm paper, ink lines, hard offset shadows,
   ReplyFlow blue as the brand colour and review-star yellow as the accent.
   ========================================================================== */

:root {
    /* Colour */
    --paper: #f5f2ea;
    --paper-2: #ebe6d9;
    --card: #ffffff;
    --ink: #111318;
    --ink-2: #353a45;
    --muted: #5d6472;
    --line: #111318;
    --line-soft: #d8d1c1;
    --shadow: #111318;

    --blue: #2d5bff;          /* brand: buttons, active states */
    --blue-deep: #1d3fc4;
    --blue-wash: #dde5ff;
    --link: #1f47e0;
    --sun: #ffc93c;           /* review-star yellow */
    --sun-wash: #fff2c9;
    --mint: #1f9d63;
    --mint-wash: #d4f2e3;
    --coral: #e8473a;
    --coral-wash: #ffe1dc;

    --on-blue: #ffffff;
    --on-sun: #111318;
    --on-ink: #f5f2ea;

    /* Type */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;

    --t-xs: 0.75rem;
    --t-sm: 0.875rem;
    --t-base: 1rem;
    --t-md: 1.125rem;
    --t-lg: 1.375rem;
    --t-xl: clamp(1.6rem, 2.6vw, 2.1rem);
    --t-2xl: clamp(2.1rem, 4.2vw, 3.25rem);
    --t-3xl: clamp(2.6rem, 6.4vw, 5.25rem);

    /* Space (4px base) */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;
    --s-8: 4rem;
    --s-9: 6rem;

    /* Lines, corners, shadows */
    --b: 2px;
    --b-lg: 3px;
    --r-sm: 4px;
    --r: 6px;
    --r-lg: 10px;
    --sh-sm: 2px 2px 0 var(--shadow);
    --sh: 4px 4px 0 var(--shadow);
    --sh-lg: 7px 7px 0 var(--shadow);

    --wrap: 1200px;
    --gutter: clamp(1rem, 4vw, 2rem);
    --header-h: 68px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="dark"] {
    --paper: #14161c;
    --paper-2: #1b1e26;
    --card: #1e2129;
    --ink: #f1eee6;
    --ink-2: #d0ccc2;
    --muted: #9ea4b0;
    --line: #d9d5cb;
    --line-soft: #3a3e49;
    --shadow: #5b6170;

    --blue-wash: #1f2a52;
    --link: #93abff;
    --sun-wash: #3d3216;
    --mint: #3cc287;
    --mint-wash: #173528;
    --coral: #ff7a6b;
    --coral-wash: #3f1e1b;
    --on-ink: #14161c;
}

/* --------------------------------------------------------------- Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--t-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

a {
    color: inherit;
}

p {
    text-wrap: pretty;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.025em;
    text-wrap: balance;
    /* Own layer, so highlighter backgrounds inside (z-index: -1) sit behind every line of text. */
    isolation: isolate;
}

::selection {
    background: var(--sun);
    color: var(--on-sun);
}

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

[hidden],
.hidden {
    display: none !important;
}

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

.skip-link {
    position: absolute;
    left: var(--s-4);
    top: -100px;
    z-index: 100;
    padding: var(--s-2) var(--s-4);
    background: var(--sun);
    color: var(--on-sun);
    border: var(--b) solid var(--line);
    font-weight: 600;
}

.skip-link:focus {
    top: var(--s-3);
}

/* --------------------------------------------------------------- Layout */
.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.wrap-narrow {
    max-width: 820px;
}

/* --------------------------------------------------------------- Type helpers */
.display {
    font-size: var(--t-3xl);
    letter-spacing: -0.04em;
    line-height: 0.98;
}

.h1 {
    font-size: var(--t-2xl);
    letter-spacing: -0.035em;
}

.h2 {
    font-size: var(--t-xl);
}

.h3 {
    font-size: var(--t-lg);
}

.lede {
    font-size: var(--t-md);
    color: var(--ink-2);
    max-width: 60ch;
}

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

.small {
    font-size: var(--t-sm);
}

.mono {
    font-family: var(--font-mono);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-2);
}

.eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--blue);
    border: 1.5px solid var(--line);
}

/* Highlighter. Painted behind the text of its heading (which isolates), so it can never cover
   the descenders (g, y, p) of the line above, however tight the line-height. */
.mark {
    position: relative;
    z-index: -1;
    background: linear-gradient(transparent 58%, var(--sun) 58%, var(--sun) 92%, transparent 92%);
    padding-inline: 0.06em;
}

[data-theme="dark"] .mark {
    background: linear-gradient(transparent 58%, var(--blue) 58%, var(--blue) 92%, transparent 92%);
}

.text-link {
    color: var(--link);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.text-link:hover {
    text-decoration-color: var(--sun);
}

/* --------------------------------------------------------------- Buttons */
.btn {
    --btn-bg: var(--card);
    --btn-fg: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-height: 44px;
    padding: 0.625rem 1.15rem;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    box-shadow: 3px 3px 0 var(--shadow);
    font-family: var(--font-display);
    font-size: var(--t-sm);
    font-weight: 700;
    letter-spacing: -0.005em;
    line-height: 1.1;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.15s;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--shadow);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--shadow);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: 3px 3px 0 var(--shadow);
}

.btn svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.btn-primary {
    --btn-bg: var(--blue);
    --btn-fg: var(--on-blue);
}

.btn-primary:hover {
    --btn-bg: var(--blue-deep);
}

.btn-sun {
    --btn-bg: var(--sun);
    --btn-fg: var(--on-sun);
}

.btn-ink {
    --btn-bg: var(--ink);
    --btn-fg: var(--on-ink);
}

.btn-danger {
    --btn-bg: var(--coral);
    --btn-fg: #fff;
}

.btn-sm {
    min-height: 36px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
}

.btn-lg {
    min-height: 54px;
    padding: 0.85rem 1.5rem;
    font-size: var(--t-base);
}

.btn-block {
    width: 100%;
}

.btn-quiet {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border-color: transparent;
    box-shadow: none;
    background: transparent;
}

.btn-quiet:hover {
    transform: none;
    box-shadow: none;
    background: var(--paper-2);
}

.btn-quiet:active {
    transform: none;
    box-shadow: none;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    transition: background-color 0.15s, transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.icon-btn:hover {
    background: var(--sun);
    color: var(--on-sun);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    align-items: center;
}

/* --------------------------------------------------------------- Surfaces */
.panel {
    background: var(--card);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh);
}

.panel-flat {
    background: var(--card);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border: 1.5px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
}

.tag-blue {
    background: var(--blue-wash);
}

.tag-sun {
    background: var(--sun-wash);
}

.tag-mint {
    background: var(--mint-wash);
}

.tag-coral {
    background: var(--coral-wash);
}

.stars {
    color: #f2a900;
    letter-spacing: 1px;
    white-space: nowrap;
}

.stars .off {
    color: var(--line-soft);
}

/* --------------------------------------------------------------- Forms */
.field {
    display: grid;
    gap: var(--s-2);
}

.field + .field {
    margin-top: var(--s-5);
}

.label {
    font-family: var(--font-display);
    font-size: var(--t-sm);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    gap: var(--s-3);
    align-items: baseline;
}

.label .opt {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

.input,
.textarea,
.select {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem 0.85rem;
    background: var(--card);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    font-size: 0.9375rem;
    transition: box-shadow 0.12s var(--ease), border-color 0.12s;
}

.textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.55;
}

.select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

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

.input[aria-invalid="true"] {
    border-color: var(--coral);
    box-shadow: 4px 4px 0 var(--coral);
}

/* Segmented choice (radio group) */
.segmented {
    display: flex;
    flex-wrap: wrap;
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--card);
    width: fit-content;
    max-width: 100%;
}

@media (max-width: 520px) {
    .segmented:not(.small) {
        display: grid;
        width: 100%;
    }

    .segmented:not(.small) span {
        border-right: 0;
        border-bottom: var(--b) solid var(--line);
    }

    .segmented:not(.small) label:last-child span {
        border-bottom: 0;
    }
}

.segmented label {
    position: relative;
    cursor: pointer;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented span {
    display: block;
    padding: 0.55rem 0.9rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--t-sm);
    border-right: var(--b) solid var(--line);
    transition: background-color 0.15s;
}

.segmented label:last-child span {
    border-right: 0;
}

.segmented label:hover span {
    background: var(--paper-2);
}

.segmented input:checked + span {
    background: var(--ink);
    color: var(--on-ink);
}

.segmented input:focus-visible + span {
    outline: 3px solid var(--blue);
    outline-offset: -5px;
}

/* Notices */
.notice {
    display: flex;
    gap: var(--s-3);
    align-items: flex-start;
    padding: var(--s-3) var(--s-4);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    font-size: var(--t-sm);
    line-height: 1.5;
}

.notice svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

.notice-error {
    background: var(--coral-wash);
}

.notice-success {
    background: var(--mint-wash);
}

.notice-info {
    background: var(--blue-wash);
}

.notice-warn {
    background: var(--sun-wash);
}

/* Spinner for busy buttons */
.spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------- Logo */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.03em;
    text-decoration: none;
    color: var(--ink);
}

.logo-mark {
    width: 32px;
    height: 32px;
    flex: none;
}

/* --------------------------------------------------------------- Motion */
@media (prefers-reduced-motion: no-preference) {
    .enter {
        animation: enter 0.55s var(--ease) both;
    }

    .enter-2 {
        animation-delay: 0.08s;
    }

    .enter-3 {
        animation-delay: 0.16s;
    }

    @keyframes enter {
        from {
            opacity: 0;
            transform: translateY(12px);
        }
    }

    @view-transition {
        navigation: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------- Click-to-copy */
.is-copyable {
    cursor: pointer;
}

/* Manager-email chips: show they're clickable */
.agency-email.is-copyable,
code.is-copyable {
    transition: background-color 0.15s, box-shadow 0.15s;
}

.agency-email.is-copyable:hover,
code.is-copyable:hover {
    background: var(--sun);
    color: #111318;
    box-shadow: 2px 2px 0 var(--shadow);
}

/* "Email copied" bubble, placed above the clicked address */
.copy-pop {
    position: fixed;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    background: #111318;
    color: #f5f2ea;
    border: 2px solid #111318;
    border-radius: var(--r);
    box-shadow: 3px 3px 0 var(--blue);
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.92);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.copy-pop.is-below {
    transform: translateY(-6px) scale(0.92);
}

.copy-pop.is-shown {
    opacity: 1;
    transform: none;
}

/* little pointer towards the address */
.copy-pop::after {
    content: "";
    position: absolute;
    left: var(--arrow-x, 50%);
    bottom: -7px;
    width: 10px;
    height: 10px;
    background: #111318;
    transform: translateX(-50%) rotate(45deg);
}

.copy-pop.is-below::after {
    bottom: auto;
    top: -7px;
}

.copy-pop svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--sun);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[data-theme="dark"] .copy-pop {
    background: #f5f2ea;
    color: #111318;
    border-color: #f5f2ea;
}

[data-theme="dark"] .copy-pop::after {
    background: #f5f2ea;
}

[data-theme="dark"] .copy-pop svg {
    stroke: var(--blue);
}
