/* =====================================================
   Story/Case Study Page Styles
   Customer stories and case studies
   ===================================================== */

/* Story Hero Section */
.story-hero {
    padding: 170px 0 60px;
    background: url('../img/bg.webp') center center / cover no-repeat;
}

.story-hero .legal-breadcrumb {
    margin-bottom: 32px;
}

.story-hero-content {
    display: flex;
    align-items: center;
    gap: 40px;
}

.story-hero-logo {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.story-hero-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-hero-text {
    flex: 1;
}

.story-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-red);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.story-label i {
    font-size: 0.85rem;
}

.story-hero-text h1 {
    font-size: 2.8rem;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.story-tagline {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.story-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.story-meta i {
    color: var(--color-blue);
}

/* Story Page Adjustments */
.story-page {
    padding-top: 60px;
}

.story-page .legal-content {
    padding: 48px;
    background: var(--color-white);
}

/* Story Sections */
.story-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--color-border-light);
    background: transparent;
}

.story-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.story-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.story-section h2 .section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    /* accessible variant: white on bright brand blue is only 2.46:1 */
    background: var(--color-blue-accessible);
    color: white;
    border-radius: 50%;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.story-section h2 i {
    color: var(--color-blue);
}

.story-section p {
    margin-bottom: 16px;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.story-section p:last-child {
    margin-bottom: 0;
}

/* Story Intro Grid */
.story-intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.story-intro-text h2 {
    margin-bottom: 24px;
}

.story-intro-text .btn {
    margin-top: 20px;
}

.story-intro-image {
    /* Static positioning */
}

/* Placeholder Images */
.story-placeholder-image {
    background: linear-gradient(135deg, var(--color-bg) 0%, #e8eef4 100%);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 40px;
    color: var(--color-text-muted);
    text-align: center;
}

.story-placeholder-image i {
    font-size: 3rem;
    opacity: 0.5;
}

.story-placeholder-image span {
    font-size: 0.9rem;
    font-weight: 500;
}

.story-placeholder-image.large {
    padding: 80px 40px;
}

.story-placeholder-image.large i {
    font-size: 4rem;
}

.story-image-placeholder {
    margin-top: 32px;
}

/* Story Images */
.story-page .story-image {
    margin-top: 32px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    aspect-ratio: unset;
    width: 100%;
}

.story-page .story-image picture {
    display: block;
    width: 100%;
}

.story-page .story-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Story Quote Section */
.story-quote-section {
    margin: 48px 0;
    padding: 0;
}

.story-quote {
    background: linear-gradient(135deg, var(--color-blue) 0%, #2f8f9d 100%);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    position: relative;
    color: white;
}

.story-quote > i {
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    top: 24px;
    left: 32px;
}

.story-quote blockquote {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 0 0 24px 0;
    padding-left: 48px;
    position: relative;
}

.story-quote-author {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-left: 48px;
}

.story-quote-author img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.story-quote-author strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 2px;
}

.story-quote-author span {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Story Overview + Testimonial Grid (two columns) */
.story-overview-section {
    margin-bottom: 40px;
}

.story-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.story-overview-content h2 {
    margin-bottom: 16px;
}

.story-overview-content > p {
    margin-bottom: 16px;
}

/* White testimonial card – matches the front page + kundehistorier overview,
   so the quotes stay visually distinct from the blue CTA. */
.story-quote-side {
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px 32px;
    position: relative;
    color: var(--color-text-secondary);
}

.story-quote-side > i {
    color: var(--color-yellow);
    font-size: 1rem;
    opacity: 0.6;
    margin-right: 8px;
    float: left;
}

.story-quote-side blockquote {
    font-size: 1rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.65;
    color: var(--color-text-secondary);
    margin: 0 0 20px 0;
}

.story-quote-side .story-quote-author {
    padding-left: 0;
    padding-top: 18px;
    border-top: 1px solid var(--color-border-light);
}

.story-quote-side .story-quote-author img {
    width: 48px;
    height: 48px;
    border: none;
}

.story-quote-side .story-quote-author strong {
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

.story-quote-side .story-quote-author span {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    opacity: 1;
}

/* Result quote reuses the side-quote card but sits full-width in the summary */
.story-result-quote {
    margin-top: 28px;
}

/* Story Highlight Boxes */
.story-highlight {
    background: var(--color-blue-light);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-left: 4px solid var(--color-blue);
}

.story-highlight.compact {
    padding: 16px 20px;
    margin: 16px 0 0;
}

.story-highlight.compact p {
    font-size: 0.9rem;
    margin: 0;
}

.story-highlight > i {
    color: var(--color-blue);
    font-size: 1.3rem;
    margin-top: 2px;
}

.story-highlight div {
    flex: 1;
}

.story-highlight strong {
    display: block;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.story-highlight p {
    margin: 0;
    color: var(--color-text-secondary);
}

.story-highlight.green {
    background: var(--color-green-light);
    border-left-color: var(--color-green);
}

.story-highlight.green > i {
    color: var(--color-green);
}

.story-highlight.yellow {
    background: var(--color-yellow-light);
    border-left-color: var(--color-yellow);
}

.story-highlight.yellow > i {
    color: var(--color-yellow);
}

.story-highlight.blue {
    background: var(--color-blue-light);
    border-left-color: var(--color-blue);
}

.story-highlight.blue > i {
    color: var(--color-blue);
}

/* Story Feature Grid */
.story-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 32px 0;
}

.story-feature-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-normal);
}

.story-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.story-feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.25rem;
    line-height: 1;
}

.story-feature-icon.blue {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.story-feature-icon.green {
    background: var(--color-green-light);
    color: var(--color-green);
}

.story-feature-icon.yellow {
    background: var(--color-yellow-light);
    color: var(--color-yellow);
}

.story-feature-icon.red {
    background: var(--color-red-light);
    color: var(--color-red);
}

.story-feature-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.story-feature-card p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Story Setup Diagram */
.story-setup-diagram {
    margin: 24px 0;
}

.story-diagram-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.story-diagram-header {
    background: var(--color-text-primary);
    color: white;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.story-diagram-header i {
    font-size: 1.1rem;
}

.story-diagram-header h3 {
    margin: 0;
    font-size: 1rem;
    color: white;
}

.story-diagram-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.story-diagram-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-light);
    border-right: 1px solid var(--color-border-light);
}

.story-diagram-list li:nth-child(even) {
    border-right: none;
}

.story-diagram-list li:nth-last-child(-n+2) {
    border-bottom: none;
}

.diagram-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.diagram-icon.blue {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.diagram-icon.green {
    background: var(--color-green-light);
    color: var(--color-green);
}

.diagram-icon.yellow {
    background: var(--color-yellow-light);
    color: var(--color-yellow);
}

.diagram-icon.red {
    background: var(--color-red-light);
    color: var(--color-red);
}

.story-diagram-list li div {
    flex: 1;
    min-width: 0;
}

.diagram-title-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.story-diagram-list li strong {
    color: var(--color-text-primary);
    font-size: 0.875rem;
}

.story-diagram-list li div > span {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: block;
}

/* Story Music Setup */
.story-music-setup {
    margin: 32px 0;
}

.story-music-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    color: white;
}

.story-music-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--color-red) 0%, #a52f2f 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.story-music-content h3 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: white;
}

.story-music-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
}

.story-music-content p:last-child {
    margin-bottom: 0;
}

.story-music-content a {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 500;
}

.story-music-content a:hover {
    text-decoration: underline;
}

/* Compact Audio Section */
.story-audio-section p a {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 500;
}

.story-audio-section p a:hover {
    text-decoration: underline;
}

.story-audio-features {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.story-audio-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.story-audio-feature .diagram-icon {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
    line-height: 1;
}

/* Story Features with TV Preview */
.story-features-section {
    background: transparent;
}

.story-features-with-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-top: 32px;
    align-items: start;
}

.story-tv-preview {
    position: relative;
}

.story-tv-frame {
    position: relative;
    width: 100%;
}

.story-tv-frame .tv-frame-bg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.2));
}

/* Static slides container for story page */
.story-slides-container {
    position: absolute;
    top: 4%;
    left: 2.3%;
    width: 95.5%;
    height: 92%;
    overflow: hidden;
    background: #1a1a2e;
    z-index: 1;
}

.story-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.story-slide.active {
    opacity: 1;
}

/* Slide info bar (below TV - contains disclaimer, progress, counter) */
.story-slide-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding: 8px 0;
}

.story-tv-disclaimer {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
    white-space: nowrap;
}

.story-tv-disclaimer i {
    color: var(--color-blue);
    margin-right: 6px;
}

.story-slide-progress {
    flex: 1;
    height: 4px;
    background: var(--color-border-light);
    border-radius: 2px;
    overflow: hidden;
    min-width: 60px;
}

.story-slide-progress-bar {
    height: 100%;
    width: 0;
    background: var(--color-green);
    border-radius: 2px;
}

.story-slide-counter {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.story-slide-counter-sep {
    opacity: 0.6;
    margin: 0 2px;
}

/* All features link (CTA button) */
.story-all-features-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-white);
    /* accessible variant: white on bright brand blue is only 2.46:1 */
    background: var(--color-blue-accessible);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.story-all-features-link:hover {
    background: var(--color-blue-hover, #226a74);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: white;
}

.story-all-features-link i:first-child {
    font-size: 0.95rem;
}

.story-all-features-link i:last-child {
    font-size: 0.8rem;
    transition: transform var(--transition-fast);
}

.story-all-features-link:hover i:last-child {
    transform: translateX(4px);
}

/* Features below TV (2 cards) */
.story-features-below-tv {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

/* Active feature card styling */
.story-feature-compact.active {
    border-color: var(--color-blue);
    box-shadow: var(--shadow-md);
    background: var(--color-white);
}

.story-feature-compact[data-feature] {
    cursor: pointer;
}

/* Touch affordance: the cards are tappable slide-pickers but that isn't obvious
   without hover. On phones give the current card a clear left accent bar (so the
   list plainly reads as "this is the slide showing now / tap to jump") and a
   brief pressed feedback on tap. */
@media (max-width: 600px) {
    .story-feature-compact[data-feature] {
        position: relative;
        -webkit-tap-highlight-color: rgba(53, 152, 168, 0.15);
    }

    .story-feature-compact.active {
        border-left-width: 3px;
        border-left-color: var(--color-blue);
    }

    .story-feature-compact[data-feature]:active {
        transform: scale(0.99);
    }
}

.story-slideshow-wrapper {
    position: absolute !important;
    top: 4%;
    left: 2.3%;
    width: 95.5% !important;
    height: 92%;
    overflow: hidden;
    background: #1a1a2e;
    border-radius: 0 !important;
    z-index: 1;
    aspect-ratio: unset !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.story-slideshow-wrapper .slideshow-container {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.story-slideshow-wrapper .slideshow-canvas {
    border-radius: 0;
}

.story-slideshow-wrapper .slideshow-controls {
    opacity: 1;
}

.story-tv-caption {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.story-tv-caption i {
    color: var(--color-green);
    margin-right: 6px;
}

/* Compact Feature List (right side - same style as below TV) */
.story-features-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-content: start;
}

.story-feature-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-normal);
}

.story-feature-compact:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.story-feature-compact-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.story-feature-compact-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.story-feature-compact-text strong {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.story-feature-compact-text span {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.story-feature-compact-icon.blue {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.story-feature-compact-icon.green {
    background: var(--color-green-light);
    color: var(--color-green);
}

.story-feature-compact-icon.yellow {
    background: var(--color-yellow-light);
    color: var(--color-yellow);
}

.story-feature-compact-icon.red {
    background: var(--color-red-light);
    color: var(--color-red);
}

/* Story Features Used (legacy - keep for now) */
.story-features-used {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 32px;
}

.story-feature-used {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-normal);
}

.story-feature-used:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.story-feature-used-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.story-feature-used-icon.blue {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.story-feature-used-icon.green {
    background: var(--color-green-light);
    color: var(--color-green);
}

.story-feature-used-icon.yellow {
    background: var(--color-yellow-light);
    color: var(--color-yellow);
}

.story-feature-used-icon.red {
    background: var(--color-red-light);
    color: var(--color-red);
}

.story-feature-used-content {
    flex: 1;
}

.story-feature-used-content h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.story-feature-used-content p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Story Summary */
.story-summary h2 {
    /* accessible variant: bright brand green on white is only 2.77:1 */
    color: var(--color-green-accessible);
}

.story-summary h2 i {
    color: var(--color-green);
}

.story-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 32px;
}

.story-summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-green-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    /* darkened green: brand green is 2.53:1 on the pale green tint */
    color: #357b38;
    font-weight: 500;
}

.story-summary-item i {
    font-size: 1.2rem;
}

/* Links in the green summary field should match the field colour, not the
   global blue link colour – keep an underline so it still reads as a link. */
.story-summary-item a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.story-summary-item a:hover {
    text-decoration: none;
}

/* Story CTA Section – matches the blue CTA used across the site
   (front page .cta-section, kundehistorier .stories-cta-section). */
.story-cta-section {
    background: linear-gradient(135deg, var(--color-blue) 0%, #2f8f9d 100%);
    border-radius: var(--radius-lg);
    padding: 60px;
    text-align: center;
    color: white;
    margin-top: 48px;
}

/* Inline links in the CTA prose: the default blue body-link colour is
   illegible on the blue gradient, so use white with an underline. */
.story-cta-section p a:not(.btn) {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.story-cta-section p a:not(.btn):hover {
    color: rgba(255,255,255,0.8);
}

.story-cta-section h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    justify-content: center;
    color: white;
}

.story-cta-section p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 32px;
    font-size: 1.15rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.story-cta-section .btn-primary {
    background: white;
    color: var(--color-link);
    padding: 16px 32px;
    font-size: 1.05rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .story-intro-grid {
        grid-template-columns: 1fr;
    }
    
    .story-intro-image {
        position: static;
    }
    
    .story-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .story-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cap the editorial body width on tablet so the reading measure stays
       comfortable and the content column sits centered. */
    .story-page .legal-content {
        max-width: 820px;
        margin-left: auto;
        margin-right: auto;
    }

    .story-features-with-preview {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .story-tv-preview {
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* On tablet, the feature list stacks below the TV preview */
    .story-features-with-preview > .story-features-compact {
        max-width: 500px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .story-hero {
        padding: 120px 0 40px;
    }

    .story-features-with-preview > .story-features-compact {
        grid-template-columns: 1fr;
    }
    
    .story-hero-content {
        flex-direction: column;
        text-align: center;
    }
    
    .story-hero-logo {
        width: 100px;
        height: 100px;
    }
    
    .story-hero-text h1 {
        font-size: 2rem;
    }
    
    .story-meta {
        justify-content: center;
    }
    
    .story-page .legal-content {
        padding: 32px 24px;
    }

    /* Keep two feature cards per row on the phone/small-tablet range so the
       row uses the width instead of a tall single-column stack. */
    .story-feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Overview + Quote grid stacks on mobile */
    .story-overview-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .story-quote-side {
        padding: 24px;
    }
    
    .story-quote-side blockquote {
        font-size: 1rem;
        padding-left: 28px;
    }
    
    .story-quote-side > i {
        font-size: 1.5rem;
        top: 16px;
        left: 18px;
    }
    
    .story-quote-side .story-quote-author {
        padding-left: 28px;
    }
    
    /* Diagram grid stacks on mobile */
    .story-diagram-list {
        grid-template-columns: 1fr;
    }
    
    .story-diagram-list li {
        border-right: none;
    }
    
    .story-diagram-list li:nth-last-child(-n+2) {
        border-bottom: 1px solid var(--color-border-light);
    }
    
    .story-diagram-list li:last-child {
        border-bottom: none;
    }
    
    /* Audio features stack */
    .story-audio-features {
        flex-direction: column;
        gap: 12px;
    }
    
    .story-quote {
        padding: 32px 24px;
    }
    
    .story-quote > i {
        font-size: 2rem;
        top: 16px;
        left: 20px;
    }
    
    /* Info bar stacks on mobile */
    .story-slide-info-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .story-tv-disclaimer {
        flex-basis: 100%;
        text-align: center;
        order: -1;
    }
    
    .story-slide-progress {
        flex: 1;
    }
    
    .story-quote blockquote {
        font-size: 1.15rem;
        padding-left: 32px;
    }
    
    .story-quote-author {
        padding-left: 32px;
    }
    
    .story-music-card {
        flex-direction: column;
        text-align: center;
    }
    
    .story-music-icon {
        margin: 0 auto;
    }
    
    .story-feature-used {
        flex-direction: column;
        text-align: center;
    }
    
    .story-feature-used-icon {
        margin: 0 auto;
    }

    /* Keep the summary as a scannable 2-up grid on mobile (five short
       result chips read better two-across than as a long single column). */
    .story-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .story-cta-section {
        padding: 32px 24px;
    }
    
    .story-cta-section h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .story-hero-text h1 {
        font-size: 1.75rem;
    }

    .story-tagline {
        font-size: 1rem;
    }

    .story-section h2 {
        font-size: 1.3rem;
    }

    /* Trim the oversized editorial padding on small phones. */
    .story-page .legal-content {
        padding: 24px 18px;
    }

    /* Feature cards and result chips go single-column on the narrowest phones,
       where two-up would squeeze the labels. */
    .story-feature-grid,
    .story-summary-grid {
        grid-template-columns: 1fr;
    }

    .story-diagram-list li {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .story-feature-compact {
        padding: 12px 16px;
    }
    
    .story-feature-compact-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* Info Tooltip (hover for explanation) */
.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: help;
    color: var(--color-text-light);
    font-size: 0.85em;
    margin-left: 6px;
    transition: color var(--transition-fast);
}

.info-tooltip:hover {
    color: var(--color-blue);
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    width: max-content;
    max-width: 280px;
    padding: 12px 14px;
    background: var(--color-text-primary);
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
    pointer-events: none;
    text-align: center;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-text-primary);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 101;
}

.info-tooltip:hover::after,
.info-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip variant for story-diagram-list - positioned to the right */
.info-tooltip-diagram {
    font-size: 0.9em;
    font-weight: 400;
    margin-left: 4px;
}

.info-tooltip-diagram::after {
    bottom: auto;
    top: 50%;
    left: calc(100% + 12px);
    transform: translateY(-50%) translateX(-5px);
    width: max-content;
    max-width: 240px;
    font-size: 0.8rem;
    z-index: 99999;
    text-align: left;
}

.info-tooltip-diagram::before {
    bottom: auto;
    top: 50%;
    left: calc(100% + 6px);
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--color-text-primary);
    border-top-color: transparent;
    z-index: 99999;
}

.info-tooltip-diagram:hover::after {
    transform: translateY(-50%) translateX(0);
}

.info-tooltip-diagram:hover::before {
    transform: translateY(-50%);
}

/* Tooltip variant for story-summary-item (green background context) */
.info-tooltip-summary {
    font-size: 0.9em;
    color: var(--color-green);
    opacity: 0.7;
    vertical-align: middle;
    top: -2px;
}

.info-tooltip-summary:hover {
    opacity: 1;
}

.info-tooltip-summary::after {
    width: max-content;
    max-width: 240px;
    font-size: 0.8rem;
}

/* =====================================================
   Touch support for tooltips
   Tapping toggles .tooltip-visible (see main.js) since
   hover does not exist on touch devices
   ===================================================== */
.info-tooltip.tooltip-visible::after,
.info-tooltip.tooltip-visible::before,
.info-tooltip:focus-visible::after,
.info-tooltip:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.info-tooltip-diagram.tooltip-visible::after,
.info-tooltip-diagram:focus-visible::after {
    transform: translateY(-50%) translateX(0);
}

.info-tooltip-diagram.tooltip-visible::before,
.info-tooltip-diagram:focus-visible::before {
    transform: translateY(-50%);
}

/* On phones the right-opening diagram/summary tooltips run off the edge of a
   ~390px screen when tapped (they're near the right side of a full-width card,
   and there's no hover fallback on touch). Flip them to open ABOVE the trigger
   like the base .info-tooltip, and clamp the width to the viewport so the
   bubble always stays on-screen and readable. */
@media (max-width: 600px) {
    .info-tooltip-diagram::after,
    .info-tooltip-summary::after {
        top: auto;
        bottom: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%) translateY(5px);
        max-width: min(240px, calc(100vw - 32px));
        text-align: center;
    }

    /* Arrow points down from the bubble above (mirrors base .info-tooltip). */
    .info-tooltip-diagram::before {
        top: auto;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: var(--color-text-primary);
        border-right-color: transparent;
    }

    .info-tooltip-diagram.tooltip-visible::after,
    .info-tooltip-diagram:focus-visible::after,
    .info-tooltip-summary.tooltip-visible::after,
    .info-tooltip-summary:focus-visible::after {
        transform: translateX(-50%) translateY(0);
    }

    .info-tooltip-diagram.tooltip-visible::before,
    .info-tooltip-diagram:focus-visible::before {
        transform: translateX(-50%);
    }
}
