/* Free calendar tool (calendar-tool.js): drop a file or paste text, see the
   events, save them to Sense or download an .ics. Mounted on the *-to-calendar
   pages in place of the hero image. */

.ct {
    --ct-radius: 28px;
    --ct-pad: clamp(1.25rem, 3vw, 2rem);
    --ct-line: rgba(45, 50, 101, 0.12);
    --ct-line-strong: rgba(45, 50, 101, 0.22);
    position: relative;
    width: 100%;
    background: #ffffff;
    border-radius: var(--ct-radius);
    border: 1px solid var(--ct-line);
    box-shadow: 0 1px 2px rgba(45, 50, 101, 0.06), 0 28px 60px -32px rgba(45, 50, 101, 0.38);
    padding: var(--ct-pad);
    color: var(--ink);
    text-align: left;
}

.ct * { box-sizing: border-box; }

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

.ct-title {
    font-size: clamp(1.2rem, 1.9vw, 1.45rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
}

.ct-sub {
    margin: 0.4rem 0 0;
    font-size: 0.98rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.ct-link {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--owl);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.ct-link:hover { border-bottom-color: currentColor; }

/* Drop zone */
.ct-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 236px;
    padding: 2rem 1.25rem;
    border-radius: 20px;
    background: var(--bg-soft);
    border: 1.5px solid var(--ct-line);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.ct-drop:hover { border-color: var(--ct-line-strong); }

.ct-drop:focus-visible {
    outline: none;
    border-color: var(--owl);
    box-shadow: 0 0 0 4px rgba(77, 95, 168, 0.18);
}

.ct-drop.is-over {
    border-color: var(--owl);
    background: #eeedf6;
    transform: scale(1.01);
}

.ct-drop-icon {
    width: 44px;
    height: 44px;
    color: var(--ink);
    margin-bottom: 1rem;
}

.ct-drop-main {
    font-size: 1.08rem;
    font-weight: 500;
    margin: 0;
}

.ct-drop-hint {
    margin: 0.35rem 0 1.25rem;
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.ct-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 1.4rem;
    border-radius: 999px;
    border: 0;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ct-btn--primary {
    background: var(--ink);
    color: #ffffff;
    box-shadow: 0 12px 26px -14px rgba(45, 50, 101, 0.6);
}

.ct-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(45, 50, 101, 0.7); }

.ct-btn--secondary {
    background: #ffffff;
    color: var(--ink);
    box-shadow: inset 0 0 0 1.5px var(--ct-line-strong);
}

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

.ct-btn--block { width: 100%; height: 54px; font-size: 1.02rem; }

.ct-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.ct-btn:focus-visible { outline: 3px solid rgba(77, 95, 168, 0.35); outline-offset: 2px; }

.ct-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

/* Paste text */
.ct-textarea {
    display: block;
    width: 100%;
    min-height: 196px;
    resize: vertical;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1.5px solid var(--ct-line-strong);
    background: #ffffff;
    font: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
}

.ct-textarea::placeholder { color: var(--ink-faint); }

.ct-textarea:focus {
    outline: none;
    border-color: var(--owl);
    box-shadow: 0 0 0 4px rgba(77, 95, 168, 0.16);
}

.ct-text-actions { margin-top: 0.9rem; display: flex; justify-content: flex-end; }

/* Working */
.ct-file {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    border-radius: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--ct-line);
}

.ct-file-glyph { width: 28px; height: 28px; color: var(--ink-soft); flex: 0 0 auto; }

.ct-file-name {
    font-weight: 500;
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct-file-meta { font-size: 0.85rem; color: var(--ink-soft); }

.ct-progress {
    height: 6px;
    border-radius: 999px;
    background: #ecebf3;
    overflow: hidden;
    margin: 1.4rem 0 1.25rem;
}

.ct-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--ink);
    transition: width 0.6s ease;
}

.ct-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }

.ct-step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.98rem;
    color: var(--ink-faint);
    transition: color 0.2s ease;
}

.ct-step.is-active { color: var(--ink); }
.ct-step.is-done { color: var(--ink-soft); }

.ct-step-mark {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ct-step.is-active .ct-step-mark {
    border-color: var(--ink);
    border-top-color: transparent;
    animation: ct-spin 0.8s linear infinite;
}

.ct-step.is-done .ct-step-mark { background: var(--ink); border-color: var(--ink); color: #ffffff; }
.ct-step-mark svg { width: 12px; height: 12px; display: none; }
.ct-step.is-done .ct-step-mark svg { display: block; }

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

.ct-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--ct-line);
}

/* Sits at the bottom of the card while it works; in the hero the card is a
   flex column, so auto margin pushes it down into the empty space. */
.ct-tip {
    margin-top: auto;
    padding-top: 1.5rem;
}

.ct-tip-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.4rem;
}

.ct-tip-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    min-height: 3em;
    transition: opacity 0.3s ease;
}

.ct-tip-text.is-fading { opacity: 0; }

/* Results */

.ct-list {
    list-style: none;
    margin: 0 calc(var(--ct-pad) * -1);
    padding: 0;
    max-height: 420px;
    overflow-y: auto;
    border-top: 1px solid var(--ct-line);
    border-bottom: 1px solid var(--ct-line);
    overscroll-behavior: contain;
}

.ct-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.9rem;
    padding: 0.95rem var(--ct-pad);
    cursor: pointer;
    transition: background 0.12s ease, opacity 0.12s ease;
}

.ct-row + .ct-row { border-top: 1px solid var(--ct-line); }
.ct-row:hover { background: #fafaf8; }
.ct-row.is-off { opacity: 0.45; }

.ct-date { text-align: center; padding-top: 0.1rem; }

.ct-date-mon {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.ct-date-day {
    display: block;
    font-size: 1.55rem;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.ct-ev-title { font-size: 1rem; font-weight: 500; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }

.ct-ev-meta { margin: 0.2rem 0 0; font-size: 0.9rem; line-height: 1.45; color: var(--ink-soft); overflow-wrap: anywhere; }

.ct-ev-repeat { margin: 0.25rem 0 0; font-size: 0.86rem; color: var(--owl); }

.ct-check {
    appearance: none;
    width: 22px;
    height: 22px;
    margin: 0.15rem 0 0;
    border-radius: 7px;
    border: 1.5px solid var(--ct-line-strong);
    background: #ffffff no-repeat center / 14px 14px;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ct-check:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5l3 3 6-7' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ct-check:focus-visible { outline: 3px solid rgba(77, 95, 168, 0.35); outline-offset: 2px; }

.ct-actions { display: grid; gap: 0.65rem; margin-top: 1.25rem; }

.ct-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }

.ct-actions-row .ct-btn { width: 100%; }

.ct-note { margin: 0.75rem 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--ink-soft); text-align: center; }

.ct-pitch {
    margin-top: 1.4rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ct-line);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.ct-pitch strong { color: var(--ink); font-weight: 500; }

/* Google picker */
.ct-gpanel {
    margin-top: 0.65rem;
    border-radius: 16px;
    border: 1px solid var(--ct-line);
    background: var(--bg-soft);
    padding: 0.5rem 0;
}

.ct-gpanel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 1rem 0.5rem;
    font-size: 0.86rem;
    color: var(--ink-soft);
}

.ct-gitem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    font-size: 0.94rem;
}

.ct-gitem span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Messages (empty, error, limit) */
.ct-message { text-align: center; padding: 1.5rem 0.5rem 0.5rem; }

.ct-message-icon { width: 40px; height: 40px; color: var(--ink); margin: 0 auto 1rem; display: block; }

.ct-message .ct-title { max-width: 30ch; margin: 0 auto 0.5rem; text-wrap: balance; }

.ct-message .ct-sub { max-width: 34ch; margin: 0 auto 1.4rem; }

.ct-message-actions { display: grid; gap: 0.65rem; max-width: 340px; margin: 0 auto; }

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

@media (max-width: 540px) {
    .ct { border-radius: 22px; }
    .ct-drop { min-height: 200px; }
    .ct-actions-row { grid-template-columns: 1fr; }
    .ct-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0.75rem; }
    .ct-list { max-height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
    .ct *, .ct *::before { transition: none !important; animation-duration: 0s !important; }
    .ct-step.is-active .ct-step-mark { animation: none; border-top-color: var(--ink); }
}

/* Hero placement: the card always spans the text column's full height, so its
   top and bottom line up with the copy whatever state it is in. Shorter states
   grow the drop zone or center their message; the results list can run taller,
   and the text stays pinned to the top. */
.hero-grid--tool {
    align-items: stretch;
}

/* The eyebrow is inline-flex, so it sits in the parent's line box and starts
   ~8px below the column top. Block-level here, it lines up with the card edge. */
.hero-grid--tool .eyebrow {
    display: flex;
    width: fit-content;
}

.hero-tool {
    display: flex;
    flex-direction: column;
}

.hero-tool > .ct {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.hero-tool .ct-drop,
.hero-tool .ct-textarea {
    flex: 1 1 auto;
}

.hero-tool .ct-message {
    margin: auto 0;
}

.ct:empty {
    min-height: 420px;
}
