@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700&display=swap');

:root {
    --surface-primary: #F9F7F2;
    --surface-secondary: #F1EDE4;
    --accent-sand: #D9D0C1;
    --text-primary: #2D2926;
    --text-secondary: #8C867E;
    --divider: #E5E0D5;
    --white: #FFFFFF;
    --accent-terracotta: #C48B77;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--surface-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Subtle paper grain — SVG noise inline, ~3% opacity */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.16 0 0 0 0 0.15 0 0 0 0.03 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Editorial display font for H1/H2 + section numbers */
h1, h2, .section-number {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    letter-spacing: -0.5px;
}

em {
    font-style: italic;
    position: relative;
    color: var(--text-primary);
}

/* Hand-drawn terracotta underline under <em> in h1/h2 */
h1 em, h2 em {
    background-image: linear-gradient(transparent 92%, var(--accent-terracotta) 92%, var(--accent-terracotta) 96%, transparent 96%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    padding: 0 0.05em;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

@media (max-width: 768px) { .container { padding: 0 24px; } }
@media (max-width: 480px) { .container { padding: 0 16px; } }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(249, 247, 242, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-inner {
    height: 88px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 768px) {
    .header-inner { height: 64px; }
}

@media (max-width: 480px) {
    .header-inner { height: 56px; }
}

.logo {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 52px;
    line-height: 1;
    letter-spacing: -1px;
}

@media (max-width: 768px) {
    .logo { font-size: 36px; letter-spacing: -0.5px; }
}

@media (max-width: 480px) {
    .logo { font-size: 28px; letter-spacing: -0.3px; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

@media (max-width: 480px) {
    .header-right { gap: 12px; }
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.lang-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.lang-btn:hover { color: var(--text-primary); }

.lang-btn.is-active {
    color: var(--text-primary);
    font-weight: 600;
}

.lang-sep {
    color: var(--divider);
    user-select: none;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--divider);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--surface-secondary);
    border-color: var(--text-secondary);
}

.cta-group {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.cta-group.centered { justify-content: center; }

@media (max-width: 480px) {
    .cta-group { flex-direction: column; width: 100%; max-width: 280px; margin-left: auto; margin-right: auto; }
    .btn { width: 100%; justify-content: center; }
    .site-header .btn { width: auto; padding: 8px 14px; font-size: 13px; }
}

/* Hero */
/* Hero — magazine-cover composition */
.hero {
    padding: 56px 0 100px;
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 48px;
    align-items: center;
}

.hero-text h1 {
    font-size: 76px;
    line-height: 1.0;
    letter-spacing: -2px;
    margin-bottom: 32px;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 400;
}

.hero-text h1 .line {
    display: block;
}

.hero-text h1 .line + .line {
    padding-left: 0.25em;
}

.hero-text h1 em {
    font-style: italic;
    font-weight: 400;
}

.hero-sub {
    font-size: 19px;
    color: var(--text-secondary);
    max-width: 460px;
    font-weight: 300;
    line-height: 1.55;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-text .cta-group {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero-mockup-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 0 10px;
    animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

/* Cascade — two flanking phones around the central animated hero-phone */
.hero-phone-aside {
    flex-shrink: 0;
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    transform-origin: center center;
    animation: fadeInUp 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.hero-phone-left {
    margin-right: -68px;
    animation-name: cascadeLeftIn;
}

.hero-phone-right {
    margin-left: -68px;
    animation-name: cascadeRightIn;
}

@keyframes cascadeLeftIn {
    from { opacity: 0; transform: scale(0.7) translateY(-10px) rotate(-3deg); }
    to   { opacity: 0.48; transform: scale(0.7) translateY(-22px) rotate(-3deg); }
}

@keyframes cascadeRightIn {
    from { opacity: 0; transform: scale(0.7) translateY(10px) rotate(3deg); }
    to   { opacity: 0.48; transform: scale(0.7) translateY(22px) rotate(3deg); }
}

/* Aside phone content — always visible, no entrance animation */
.aside-cards {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aside-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

.aside-widget {
    margin-top: 14px;
    background: #C5D4C3;
    border-radius: 16px;
    padding: 18px 18px 16px;
    color: #2D2926;
}

.aside-widget .widget-emoji {
    font-size: 22px;
    margin-bottom: 8px;
}

.aside-widget .widget-event {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.aside-widget .widget-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.aside-widget .widget-aside-num {
    font-family: 'Instrument Serif', serif;
    font-size: 48px;
    line-height: 1;
    color: #5B7855;
}

.aside-widget .widget-days-label {
    font-size: 12px;
    color: #5B7855;
    opacity: 0.85;
}

.hero-phone { z-index: 2; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }
    .hero-text h1 {
        font-size: 56px;
        letter-spacing: -1.5px;
        margin-bottom: 28px;
    }
    .hero-text h1 .line + .line { padding-left: 0; }
    .hero-sub { font-size: 17px; }
    .hero-phone-aside { display: none; }
}

@media (max-width: 480px) {
    .hero { padding: 32px 0 56px; }
    .hero-text h1 { font-size: 42px; letter-spacing: -1px; }
    .hero-sub { font-size: 16px; }
}

/* Phone mockup — used in hero + by-section variants */
.phone-mockup {
    width: 300px;
    background: var(--surface-primary);
    border: 1px solid var(--divider);
    border-radius: 32px;
    padding: 24px 20px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.phone-topbar {
    font-family: 'Instrument Serif', serif;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 18px;
    letter-spacing: 0.5px;
}

.phone-prompt {
    background: var(--surface-secondary);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 70px;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.45;
}

.prompt-sparkle {
    color: var(--accent-terracotta);
    margin-right: 4px;
    flex-shrink: 0;
}

.prompt-placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.prompt-typed {
    color: var(--text-primary);
    font-weight: 500;
}

.prompt-cursor {
    color: var(--accent-terracotta);
    font-weight: 600;
    margin-left: 2px;
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.phone-generating {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0;
    text-align: center;
    min-height: 16px;
}

.phone-cards {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-card {
    background: var(--white);
    border: 1px solid var(--divider);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(12px);
}

.event-body { flex: 1; min-width: 0; }

.event-emoji {
    font-size: 22px;
    flex-shrink: 0;
}

.event-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.event-countdown {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--accent-terracotta);
    background: rgba(196, 139, 119, 0.10);
    border-radius: 999px;
    padding: 4px 10px;
    font-variant-numeric: tabular-nums;
}

/* When the .play class is added, animation kicks in (Task 7) */
.phone-mockup.play .prompt-placeholder { display: none; }
.phone-mockup.play .phone-generating,
.phone-mockup.play .event-card {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 480px) {
    .phone-mockup { width: 100%; max-width: 320px; }
}

/* Hero mockup animation — plays once when .play is added (in-view) */
.phone-mockup.play .prompt-typed {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    max-width: 0;
    animation: typewriter 3.5s steps(60, end) 0.5s forwards;
}

/* Trick: we animate max-width from 0 to a wide value so steps() reveals text */
@keyframes typewriter {
    from { max-width: 0; }
    to { max-width: 100%; }
}

.phone-mockup.play .phone-generating {
    animation: fadeInOut 1s ease-in-out 4s both;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    30%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

.phone-mockup.play .event-card-1 {
    animation: cardSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 4.5s forwards;
}

.phone-mockup.play .event-card-2 {
    animation: cardSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 5.5s forwards;
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.phone-mockup.play .phone-cards {
    animation: cardsBreath 4s ease-in-out 7s infinite;
}

@keyframes cardsBreath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.005); }
}

/* Inject prompt content via CSS content() so we can swap it per language */
.phone-mockup.play .prompt-typed::before {
    content: attr(data-text);
}

/* Reduced motion — freeze on final state */
@media (prefers-reduced-motion: reduce) {
    .hero-phone-aside { animation: none !important; }
    .hero-phone-left { opacity: 0.48 !important; transform: scale(0.7) translateY(-22px) rotate(-3deg) !important; }
    .hero-phone-right { opacity: 0.48 !important; transform: scale(0.7) translateY(22px) rotate(3deg) !important; }
    .phone-mockup .prompt-placeholder { display: none; }
    .phone-mockup .prompt-typed { animation: none !important; max-width: 100%; width: auto; }
    .phone-mockup .prompt-typed::before { content: attr(data-text); }
    .phone-mockup .phone-generating { opacity: 0 !important; animation: none !important; }
    .phone-mockup .event-card { opacity: 1 !important; transform: none !important; animation: none !important; }
    .phone-mockup .phone-cards { animation: none !important; }
    .prompt-cursor { animation: none !important; opacity: 0; }
    .hero-text h1, .hero-sub, .hero-text .cta-group, .hero-mockup-wrap { animation: none !important; opacity: 1; transform: none; }
}

/* Numbered sections (01, 02, 03) */
.numbered-section {
    padding: 100px 0;
}

.numbered-section + .numbered-section { padding-top: 40px; }

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.split.reverse .split-text { order: 1; }
.split.reverse .split-mockup { order: 2; }

.split-text .section-number {
    font-size: 56px;
    color: var(--accent-terracotta);
    font-style: italic;
    line-height: 1;
    margin-bottom: 16px;
    opacity: 0.85;
}

.split-text h2 {
    font-size: 44px;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -1.5px;
}

.split-text p {
    font-size: 17px;
    color: var(--text-secondary);
    font-weight: 300;
    line-height: 1.65;
    max-width: 480px;
}

.split-mockup {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Voice STT mockup (section 01) */
.voice-mockup {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border: 1px solid var(--divider);
    border-radius: 22px;
    padding: 28px 28px 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.06);
}

.voice-label {
    font-size: 13px;
    color: var(--accent-terracotta);
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    font-weight: 500;
}

.voice-transcript {
    font-size: 18px;
    color: var(--text-primary);
    line-height: 1.45;
    margin-bottom: 22px;
}

.waveform {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 28px;
}

.waveform span {
    flex: 1;
    background: var(--accent-terracotta);
    border-radius: 2px;
    height: 30%;
    animation: wave 1.2s ease-in-out infinite;
    opacity: 0.7;
}

.waveform span:nth-child(1)  { animation-delay: 0s; }
.waveform span:nth-child(2)  { animation-delay: 0.1s; }
.waveform span:nth-child(3)  { animation-delay: 0.2s; }
.waveform span:nth-child(4)  { animation-delay: 0.3s; }
.waveform span:nth-child(5)  { animation-delay: 0.4s; }
.waveform span:nth-child(6)  { animation-delay: 0.5s; }
.waveform span:nth-child(7)  { animation-delay: 0.4s; }
.waveform span:nth-child(8)  { animation-delay: 0.3s; }
.waveform span:nth-child(9)  { animation-delay: 0.2s; }
.waveform span:nth-child(10) { animation-delay: 0.1s; }
.waveform span:nth-child(11) { animation-delay: 0s; }

@keyframes wave {
    0%, 100% { height: 25%; }
    50% { height: 95%; }
}

/* Chat bubbles mockup (section 02) */
.chat-mockup {
    width: 100%;
    max-width: 380px;
    background: var(--surface-secondary);
    border-radius: 22px;
    padding: 26px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-row-app { align-items: flex-end; }

.chat-author {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
    padding: 0 6px;
}

.chat-bubble {
    background: var(--white);
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.45;
    max-width: 85%;
}

.chat-bubble-app {
    background: var(--text-primary);
    color: var(--white);
}

/* Widget mockup (section 03) */
.widget-mockup {
    width: 100%;
    max-width: 280px;
    background: #C5D4C3; /* Sage secondary, see Color.kt */
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
    text-align: left;
    color: #2D2926;
}

.widget-emoji {
    font-size: 28px;
    margin-bottom: 14px;
}

.widget-event {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
}

.widget-count {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.widget-days-num {
    font-family: 'Instrument Serif', serif;
    font-size: 64px;
    line-height: 1;
    color: #5B7855; /* Sage dark accent */
}

.widget-days-label {
    font-size: 14px;
    color: #5B7855;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 900px) {
    .split { grid-template-columns: 1fr; gap: 48px; }
    .split.reverse .split-text { order: 2; }
    .split.reverse .split-mockup { order: 1; }
    .split-text h2 { font-size: 36px; letter-spacing: -1px; }
    .split-text .section-number { font-size: 44px; }
    .numbered-section { padding: 64px 0; }
}

@media (max-width: 480px) {
    .split-text h2 { font-size: 30px; }
    .split-text p { font-size: 16px; }
    .split-text .section-number { font-size: 36px; }
    .numbered-section { padding: 48px 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .waveform span { animation: none !important; height: 50%; }
}

/* Features Grid (secondary) */
.features {
    padding: 100px 0;
    background: var(--surface-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 56px 40px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.feature-item h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.feature-item p {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 300;
    line-height: 1.6;
}

@media (max-width: 1024px) {
    .features-grid { grid-template-columns: repeat(2, 1fr); gap: 40px; }
}

@media (max-width: 640px) {
    .features-grid { grid-template-columns: 1fr; gap: 36px; }
    .features { padding: 64px 0; }
}

/* Highlight banner */
.highlight-section {
    padding: 120px 0;
    text-align: center;
    background: var(--surface-primary);
}

.highlight-section h2 {
    font-size: 48px;
    max-width: 800px;
    margin: 0 auto 20px;
    line-height: 1.15;
    letter-spacing: -1.5px;
}

.highlight-section p {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 36px;
    font-weight: 300;
}

@media (max-width: 768px) {
    .highlight-section { padding: 72px 0; }
    .highlight-section h2 { font-size: 36px; letter-spacing: -1px; }
    .highlight-section p { font-size: 16px; }
}

@media (max-width: 480px) {
    .highlight-section h2 { font-size: 30px; }
}

/* Footer */
.site-footer {
    padding: 32px 0;
    border-top: 1px solid var(--divider);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.site-footer .logo { font-size: 22px; }

@media (max-width: 480px) {
    .footer-inner { flex-direction: column; gap: 14px; text-align: center; }
}

/* Scroll-triggered fade-in for numbered sections + highlight */
.numbered-section .split-text,
.numbered-section .split-mockup,
.highlight-section h2,
.highlight-section p,
.highlight-section .cta-group {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.in-view .split-text,
.in-view .split-mockup,
.in-view h2,
.in-view p,
.in-view .cta-group {
    opacity: 1;
    transform: translateY(0);
}

.in-view .split-mockup { transition-delay: 0.1s; }
.in-view .split-text   { transition-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
    .numbered-section .split-text,
    .numbered-section .split-mockup,
    .highlight-section h2,
    .highlight-section p,
    .highlight-section .cta-group {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
