/* StoryPeeker - main stylesheet
   Visual language: Instagram light mode. White surfaces, the Instagram
   gradient as the only accent, near-black type, heavy rounding. */

:root {
    /* The Instagram gradient, using Instagram's own brand hues:
       warm gold -> IG pink -> IG purple. This is the accent for the
       whole site, the way snap yellow was on the old build. */
    --grad: linear-gradient(45deg, #FCAF45 0%, #E1306C 52%, #833AB4 100%);
    --grad-soft: linear-gradient(135deg, #FFF3E6 0%, #FDEAF1 46%, #F3ECFB 100%);
    --accent: #E1306C;
    --accent-2: #833AB4;
    --accent-tint: #FCE3EE;
    --black: #000000;
    --ink: #262626;
    --body: #4A5056;
    --muted: #5F666C;
    --white: #FFFFFF;
    --surface: #F7F8F9;
    --surface-2: #EFF1F3;
    --line: #E4E7EA;
    --danger: #D02B20;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(22, 25, 28, .05), 0 6px 16px rgba(22, 25, 28, .05);
    --shadow-md: 0 2px 4px rgba(22, 25, 28, .05), 0 16px 40px rgba(22, 25, 28, .09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--white);
    color: var(--body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { color: var(--black); line-height: 1.15; font-weight: 700; letter-spacing: -.025em; }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: 900px; margin: 0 auto; padding: 0 22px; }

/* ---------- Skip link ---------- */

.skip-link {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -120%);
    z-index: 1000;
    background: var(--black);
    color: var(--white);
    font-size: .92rem;
    font-weight: 700;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 0 0 var(--r-md) var(--r-md);
    transition: transform .15s ease;
}

.skip-link:focus { transform: translate(-50%, 0); }

/* ---------- Focus ---------- */

:focus-visible {
    outline: 3px solid var(--black);
    outline-offset: 3px;
}

.hero :focus-visible,
.page-head :focus-visible { outline-color: var(--black); }

.site-footer :focus-visible { outline-color: var(--white); }

/* ---------- Header ---------- */

/* Transparent over the hero, solid once the page scrolls. Fixed rather than
   sticky so the hero background runs underneath it. */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background .25s ease, border-color .25s ease;
}

.site-header.scrolled,
.site-header.nav-open {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom-color: var(--line);
}

/* Clears the fixed header on any page. The hero cancels it and reclaims the
   space so its background sits behind the header. */
main { padding-top: 70px; }

.header-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--black);
    text-decoration: none;
}

.brand img { width: 32px; height: 32px; flex-shrink: 0; }

.site-nav ul { list-style: none; display: flex; align-items: center; gap: 30px; }

.site-nav a {
    color: var(--ink);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
    padding: 5px 0;
    border-bottom: 3px solid transparent;
    transition: border-color .15s ease;
}

.site-nav a:hover { border-bottom-color: var(--accent); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--black);
}

.nav-toggle svg { width: 20px; height: 20px; display: block; }
.nav-toggle .icon-close { display: none; }
.site-header.nav-open .nav-toggle .icon-close { display: block; }
.site-header.nav-open .nav-toggle .icon-menu { display: none; }

/* ---------- Hero ---------- */

/* A soft Instagram wash: pale gold to pale pink to pale lavender. It is
   light enough that black type reads cleanly, and it needs no image file. */
.hero {
    background: var(--grad-soft);
    border-bottom: 1px solid var(--line);
    margin-top: -70px;
    padding: 148px 0 84px;
    text-align: center;
}

.hero h1 { font-size: clamp(2.6rem, 5.6vw, 4rem); font-weight: 800; margin-bottom: 22px; }

.hero-lead {
    font-size: clamp(1.1rem, 2.4vw, 1.25rem);
    line-height: 1.6;
    color: rgba(0, 0, 0, .72);
    max-width: 600px;
    margin: 0 auto 36px;
}

/* ---------- Search card ---------- */

.search { max-width: 680px; margin: 0 auto; }

/* Desktop: one white capsule holds the field and the submit button.
   Mobile: the capsule shrinks to the field only and the button drops
   outside it. See the 640px block at the bottom. */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 7px 7px 20px;
    box-shadow: var(--shadow-md);
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.search-bar:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.search-bar.input-error { border-color: var(--danger); }

.input-icon {
    flex-shrink: 0;
    width: 21px;
    height: 21px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke .15s ease;
}

.search-bar:focus-within .input-icon { stroke: var(--accent); }

.search-bar input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--black);
    background: transparent;
    border: none;
    outline: none;
    padding: 17px 0;
}

.search-bar input::placeholder { color: #767D83; font-weight: 400; }

.btn-paste {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: .86rem;
    font-weight: 700;
    color: var(--black);
    background: var(--surface);
    border: none;
    border-radius: 999px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background .15s ease;
}

.btn-paste:hover { background: var(--surface-2); }

.btn-paste svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-go {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--white);
    background: var(--grad);
    border: none;
    border-radius: 999px;
    padding: 18px 26px;
    cursor: pointer;
    transition: filter .15s ease, transform .1s ease;
}

.btn-go:hover { filter: brightness(1.06) saturate(1.05); }
.btn-go:active { transform: scale(.98); }

.btn-go svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Share row ---------- */

.share { margin-top: 30px; text-align: center; }

.share-label {
    font-size: .88rem;
    font-weight: 700;
    color: rgba(0, 0, 0, .6);
    margin-bottom: 12px;
}

.share-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.share-btn {
    position: relative;
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background .15s ease, transform .12s ease;
}

.share-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.share-btn:active { transform: translateY(0); }

.share-btn img { width: 21px; height: 21px; }

.share-copied {
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--black);
    color: var(--white);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: var(--r-sm);
}

/* Error message stays for screen readers, the visible signal is the red border. */
.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;
}

.btn {
    display: inline-block;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 17px 26px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.btn:active { transform: scale(.985); }

.btn-primary { background: var(--grad); color: var(--white); width: 100%; }
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); }

.btn-secondary { background: var(--white); color: var(--black); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--black); }

.loader { display: none; text-align: center; padding: 14px 0; }

.spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto 12px;
    border: 3px solid var(--accent-tint);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader p { font-size: .93rem; font-weight: 600; color: rgba(0, 0, 0, .7); }

/* ---------- Sections ---------- */

.section { padding: 74px 0; }
.section-panel { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { margin-bottom: 38px; }
.section-head h2 { font-size: clamp(2rem, 4.4vw, 2.8rem); font-weight: 700; margin-bottom: 14px; }
.section-head p { color: var(--muted); max-width: 620px; font-size: 1.05rem; }

.section-head-center { text-align: center; margin-bottom: 44px; }
.section-head-center p { margin-left: auto; margin-right: auto; }

/* ---------- Steps: alternating media and copy ---------- */

.steps { list-style: none; }

.how-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
    margin-bottom: 60px;
}

.how-row:last-child { margin-bottom: 0; }

/* Rows 1 and 3 put the media on the left, row 2 flips it. Copy stays first
   in the markup so the reading order is right on mobile and for crawlers. */
.how-row:nth-child(odd) .how-media { order: -1; }

.how-media img {
    display: block;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}

.step-num {
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}

.how-copy h3 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 10px; }
.how-copy p { font-size: 1rem; }

/* Content-only steps: three plain containers, no media column. */
.step-list { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

.step-item {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 30px 28px;
}

.step-n {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--grad);
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 18px;
}

.step-item h3 { font-size: 1.15rem; margin-bottom: 8px; }
.step-item p { font-size: .97rem; }

/* ---------- Interior pages: legal, contact, 404 ---------- */

.page-head {
    background: var(--grad-soft);
    border-bottom: 1px solid var(--line);
    margin-top: -70px;
    padding: 132px 0 52px;
    text-align: center;
}

.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 8px; }

.page-head p { color: rgba(0, 0, 0, .68); font-size: 1rem; }

.legal-content { padding-top: 56px; padding-bottom: 72px; }

.legal-content h2 { font-size: 1.35rem; margin: 36px 0 12px; }
.legal-content h2:first-child { margin-top: 0; }

.legal-content h3 { font-size: 1.08rem; margin: 26px 0 8px; }

.legal-content p { margin-bottom: 16px; }
.legal-content p:last-child { margin-bottom: 0; }

.legal-content ul { margin: 0 0 16px 22px; }
.legal-content li { margin-bottom: 9px; }

.legal-updated {
    font-size: .9rem;
    color: var(--muted);
    padding-bottom: 22px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

/* 404 */
.notfound { text-align: center; padding: 84px 0 92px; }
.notfound-code { font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.notfound h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 10px 0 12px; }
.notfound p { max-width: 460px; margin: 0 auto 28px; }

/* ---------- Feature grid ---------- */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    padding: 32px 26px;
    text-align: center;
    transition: transform .22s ease, box-shadow .22s ease;
}

.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 16px;
    background: var(--grad);
    box-shadow: 0 6px 16px rgba(131, 58, 180, .18);
}

/* Icons ship as black line art; this recolours them white on the gradient. */
.feature-icon img { width: 26px; height: 26px; filter: brightness(0) invert(1); }

.feature h3 { font-size: 1.2rem; margin-bottom: 6px; }

.feature p { font-size: 1rem; color: var(--muted); max-width: 300px; margin: 0 auto; }

/* ---------- Article copy ---------- */

/* Section titles are centred over left-aligned body copy, the same way
   the how-it-works and FAQ headings sit. */
.article-section h2 { font-size: clamp(2rem, 4.4vw, 2.8rem); font-weight: 700; margin-bottom: 26px; text-align: center; }
.article-section h3 { font-size: 1.5rem; margin: 32px 0 10px; }
.article-section p { font-size: 1.05rem; margin-bottom: 17px; }
.article-section p:last-child { margin-bottom: 0; }
.article-section ul { margin: 0 0 16px 20px; }
.article-section li { margin-bottom: 8px; }

.article-lead { font-size: 1.13rem; color: var(--ink); }

/* Shared link rule. Extend this selector list for new containers.
   Never write a one-off rule or an inline style for a link. */
.article-section a,
.faq-content a,
.content-section a,
.legal-content a,
.viewer-switch a {
    color: var(--black);
    font-weight: 600;
    text-decoration: none;
    box-shadow: inset 0 -.5em 0 var(--accent-tint);
    transition: box-shadow .15s ease, color .15s ease;
}

.article-section a:hover,
.faq-content a:hover,
.content-section a:hover,
.legal-content a:hover,
.viewer-switch a:hover { color: var(--accent); box-shadow: inset 0 -1.05em 0 var(--accent-tint); }

/* Contextual link under the search that points at the sibling tool. */
.viewer-switch { text-align: center; margin-top: 20px; font-size: 1rem; color: var(--muted); }

/* ---------- FAQ ---------- */

.faq-list { border-top: 1px solid var(--line); }

.faq-item { border-bottom: 1px solid var(--line); }

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 22px 40px 22px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--black);
    position: relative;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-top: -6px;
    border-right: 2.5px solid var(--black);
    border-bottom: 2.5px solid var(--black);
    transform: rotate(45deg);
    transition: transform .2s ease;
}

.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }

.faq-content { padding: 0 0 22px; }
.faq-content p { margin-bottom: 12px; }
.faq-content p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer { background: #16191C; padding: 60px 0 32px; }

.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }

.site-footer .brand { margin-bottom: 14px; color: var(--white); }

.footer-desc { font-size: .94rem; max-width: 320px; color: #A7ADB4; }

.footer-col h4 { font-size: .95rem; margin-bottom: 14px; color: var(--white); }

.footer-nav { list-style: none; }
.footer-nav li { margin-bottom: 9px; }

.footer-nav a {
    color: #A7ADB4;
    text-decoration: none;
    font-size: .94rem;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}

.footer-nav a:hover { color: var(--white); border-bottom-color: var(--accent); }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    margin-top: 44px;
    padding-top: 24px;
    font-size: .88rem;
    color: #7E858D;
}

.footer-bottom p { margin-bottom: 8px; }
.footer-bottom p:last-child { margin-bottom: 0; }

/* ---------- Motion ---------- */

/* Reveal targets start hidden only when JS is on. The .motion class is set in
   the head before first paint, so no-JS users and crawlers still see it all.
   Reveals use `translate` + `opacity` and leave `transform` free for hovers. */
.motion .section-head,
.motion .feature,
.motion .how-row,
.motion .article-section,
.motion .faq-item {
    opacity: 0;
    translate: 0 24px;
    transition: opacity .7s cubic-bezier(.16, .84, .44, 1),
                translate .7s cubic-bezier(.16, .84, .44, 1);
}

.motion .section-head.in,
.motion .feature.in,
.motion .how-row.in,
.motion .article-section.in,
.motion .faq-item.in {
    opacity: 1;
    translate: 0 0;
}

/* Feature cards land as a set, so stagger them a touch. */
.motion .feature:nth-child(2) { transition-delay: .09s; }
.motion .feature:nth-child(3) { transition-delay: .18s; }

/* Hero content rises on load rather than on scroll. The h1 and lead are left
   out on purpose so the LCP text paints instantly and the score stays clean. */
.motion .hero > .container > .search,
.motion .hero > .container > .viewer-switch,
.motion .hero > .container > .share {
    opacity: 0;
    animation: rise .8s cubic-bezier(.16, .84, .44, 1) forwards;
}

.motion .hero > .container > .viewer-switch { animation-delay: .08s; }
.motion .hero > .container > .share { animation-delay: .16s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}

/* Small hover life on the step images and question rows. */
.how-media img { transition: transform .4s ease; }
.how-media:hover img { transform: scale(1.02); }

.faq-item summary { transition: color .18s ease; }
.faq-item summary:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .motion .section-head,
    .motion .feature,
    .motion .how-row,
    .motion .article-section,
    .motion .faq-item {
        opacity: 1;
        translate: none;
        transition: none;
    }

    .motion .hero > .container > * {
        opacity: 1;
        animation: none;
    }

    .feature:hover { transform: none; }
    .how-media:hover img { transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .how-row { grid-template-columns: 1fr; gap: 22px; margin-bottom: 44px; }
    .how-row:nth-child(odd) .how-media { order: 0; }

    .feature-grid { grid-template-columns: 1fr; gap: 26px; }

    .step-list { grid-template-columns: 1fr; }

    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .footer-grid .brand-col { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    /* Legal and utility pages. The 70px fixed header eats the top padding,
       so these numbers are header height plus real breathing room, not the
       desktop values shrunk by eye. */
    .page-head { padding: 112px 0 34px; }
    .page-head p { font-size: .95rem; }
    .legal-content { padding-top: 30px; padding-bottom: 52px; }
    .legal-updated { padding-bottom: 16px; margin-bottom: 24px; }
    .legal-content h2 { font-size: 1.2rem; margin: 30px 0 10px; }
    .legal-content h3 { font-size: 1.02rem; margin: 22px 0 8px; }
    .legal-content ul { margin-left: 18px; }

    .nav-toggle { display: block; }

    .site-nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 70px;
        background: var(--white);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-md);
        padding: 8px 22px 16px;
    }

    .site-header.nav-open .site-nav { display: block; }

    .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav li { border-top: 1px solid var(--line); }
    .site-nav li:first-child { border-top: none; }
    .site-nav a { display: block; padding: 14px 0; border-bottom: none; }

    .hero { padding: 120px 0 58px; }
    .section { padding: 54px 0; }

    .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    /* The outer bar stops being a surface. It just stacks the field and
       the button, and the white capsule moves onto the field itself. */
    .search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    .search-bar:focus-within { box-shadow: none; transform: none; }

    .search-field {
        flex: none;
        background: var(--white);
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 10px 10px 10px 18px;
        box-shadow: var(--shadow-md);
        transition: border-color .15s ease;
    }

    .search-bar:focus-within .search-field { border-color: var(--accent); }

    .search-bar.input-error .search-field { border-color: var(--danger); }

    .search-bar input { font-size: 1rem; padding: 14px 0; }
    .btn-paste { font-size: .82rem; padding: 9px 13px; }

    .btn-go { width: 100%; padding: 18px 20px; }
}

#loaderStep { animation: stepIn .35s ease; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
