/* ============================================
   Rewrite This — Deconstructed Chaos
   ============================================ */

/* --- Custom Properties --- */
:root {
    --color-primary: #7b46ff;
    --color-black: #000000;
    --color-white: #ffffff;
    --color-ios-blue: #007aff;
    --color-ios-selection: #003870;
    --color-slate-100: #f1f5f9;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;

    --primary-gradient: linear-gradient(135deg, #5c4eff 0%, #a255ff 100%);

    --font-mono-space: "Space Grotesk", monospace;
    --font-sans: "Inter", sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-black);
    color: var(--color-slate-100);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* --- Entrance Animations --- */
@keyframes hero-primary-enter {
    from {
        opacity: 0;
        transform: rotate(-8deg) translateX(-5rem);
    }
    to {
        opacity: 1;
        transform: rotate(-2deg);
    }
}

@keyframes hero-secondary-enter {
    from {
        opacity: 0;
        transform: rotate(5deg) translateY(2rem);
    }
    to {
        opacity: 1;
        transform: rotate(1deg);
    }
}

@keyframes hero-tagline-enter {
    from {
        opacity: 0;
        transform: rotate(7deg) translateY(1rem);
    }
    to {
        opacity: 1;
        transform: rotate(3deg);
    }
}

@keyframes bounce-up {
    0% {
        opacity: 0;
        transform: translateY(3rem) scale(0.9);
    }
    65% {
        opacity: 1;
        transform: translateY(-0.3rem) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .hero-word-primary {
        animation: hero-primary-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s
            both;
    }

    .hero-word-secondary {
        animation: hero-secondary-enter 0.55s cubic-bezier(0.16, 1, 0.3, 1)
            0.25s both;
    }

    .hero-tagline {
        animation: hero-tagline-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s
            both;
    }

    .cta-button-group {
        animation: bounce-up 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 1.3s both;
    }
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.08;
    pointer-events: none;
}

/* --- Site Navigation --- */
.site-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 0.5rem 1.5rem 2.5rem;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.8) 3rem,
        transparent
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    mask: linear-gradient(to bottom, black 3rem, transparent);
    -webkit-mask: linear-gradient(to bottom, black 3rem, transparent);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo-name {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.logo-icon {
    color: var(--color-white);
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    line-height: 1 !important;
}

.logo-text {
    font-weight: 900;
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    letter-spacing: -0.05em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.logo-version {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5em;
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
}

.nav-link {
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link--bordered {
    border-bottom: 1px solid rgba(123, 70, 255, 0.4);
}

/* --- Plasma Glow Animations --- */
@keyframes glow-drift-top {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    30% {
        transform: translate(12%, 8%) scale(1.1);
    }
    65% {
        transform: translate(-8%, 12%) scale(0.93);
    }
}

@keyframes glow-drift-bottom {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    40% {
        transform: translate(-10%, -8%) scale(1.08);
    }
    75% {
        transform: translate(8%, -12%) scale(0.92);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .plasma-glow--top {
        animation: glow-drift-top 12s ease-in-out infinite;
    }

    .plasma-glow--bottom {
        animation: glow-drift-bottom 15s ease-in-out infinite;
    }
}

/* --- Plasma Glow Backgrounds --- */
.plasma-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.plasma-glow {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(123, 70, 255, 0.4) 0%,
        rgba(0, 0, 0, 0) 70%
    );
    filter: blur(80px);
}

.plasma-glow--top {
    top: 15%;
    left: -5%;
    width: 70vw;
    height: 70vw;
    opacity: 0.3;
}

.plasma-glow--bottom {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    opacity: 0.4;
}

/* --- Main Content --- */
.main-content {
    position: relative;
    min-height: 100vh;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    z-index: 10;
    padding: 5rem 1.5rem 2rem;
    overflow-x: clip;
}

.hero-container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    container-type: inline-size;
    container-name: hero;
}

.hero-heading {
    font-weight: 900;
    line-height: 0.75;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    font-style: italic;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
}

.hero-word-primary {
    font-size: 18cqi;
    background-color: var(--color-white);
    color: var(--color-black);
    padding: 0.3cqi 2.3cqi 0.3cqi 1.1cqi;
    align-self: flex-start;
    transform: rotate(-2deg);
    mix-blend-mode: screen;
    position: relative;
    z-index: 10;
}

.hero-secondary-row {
    display: flex;
    align-items: center;
    margin-left: 4cqi;
    padding-right: 4cqi;
    gap: 3.5cqi;
}

.hero-word-secondary {
    font-size: 14cqi;
    color: var(--color-white);
    transform: rotate(1deg);
    border-left: 0.7cqi solid var(--color-primary);
    padding-left: 1.7cqi;
    position: relative;
    z-index: 10;
    margin-top: 1.5cqi;
}

.hero-tagline {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 30;
    margin-left: auto;
    font-size: 3.5cqi;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    transform: rotate(3deg);
}

.hero-tagline-accent {
    color: var(--color-primary);
    display: block;
    white-space: nowrap;
}

.hero-tagline-underline {
    color: var(--color-white);
    display: block;
    position: relative;
    white-space: nowrap;
}

.hero-tagline-underline::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0.05em;
    width: 100%;
    height: 0.12em;
    background-color: var(--color-primary);
}

/* --- Input Card --- */
.input-card {
    container-type: inline-size;
    container-name: input-card;
    position: relative;
    z-index: 10;
    padding: 0 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-content {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
}

.input-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-ios-blue);
    margin-bottom: 1.5rem;
    letter-spacing: 0.4em;
}

.ios-selection-box {
    position: relative;
    display: inline-block;
}

.ios-selection-highlight {
    position: relative;
    background-color: var(--color-ios-selection);
    padding: 0.25rem;
}

.ios-handle {
    position: absolute;
    width: 2px;
    height: 100%;
    background-color: var(--color-ios-blue);
    top: 0;
}

.ios-handle--left {
    left: 0;
}

.ios-handle--right {
    right: 0;
}

.ios-handle-dot {
    position: absolute;
    width: 0.75rem;
    height: 0.75rem;
    background-color: var(--color-ios-blue);
    border-radius: 50%;
}

.ios-handle--left .ios-handle-dot {
    top: -0.375rem;
    left: -0.375rem;
}

.ios-handle--right .ios-handle-dot {
    bottom: -0.375rem;
    right: -0.375rem;
}

.input-text {
    font-size: clamp(0.875rem, 3.5cqi, 1.25rem);
    font-weight: 300;
    color: var(--color-white);
    line-height: 1.375;
}

/* --- CTA Section --- */
.cta-section {
    position: relative;
    z-index: 20;
    padding: 1rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: clip;
}

.cta-container {
    max-width: 56rem;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(3.5rem, 9cqi, 5rem);
    container-type: inline-size;
    container-name: cta;
}

.ios-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
}

.ios-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.cta-glow {
    position: absolute;
    inset: 0;
    background-color: rgba(123, 70, 255, 0.1);
    filter: blur(150px);
    z-index: -1;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.cta-button-group {
    flex-shrink: 0;
    position: relative;
}

.cta-button {
    background: var(--primary-gradient);
    color: var(--color-white);
    font-size: clamp(1.25rem, 4cqi, 2.25rem);
    font-weight: 900;
    padding: clamp(1rem, 5cqi, 3rem);
    text-transform: uppercase;
    letter-spacing: -0.05em;
    transition: all 0.3s ease;
    transform: rotate(-3deg);
    box-shadow: 0 25px 50px -12px rgba(123, 70, 255, 0.2);
}

.cta-button-group:hover .cta-button {
    transform: rotate(0deg) scale(1.05);
}

.cta-button-shadow {
    position: absolute;
    inset: 0;
    border: 2px solid var(--color-primary);
    transform: translateX(clamp(0.5rem, 1.1cqi, 1rem))
        translateY(clamp(3rem, 7cqi, 4rem));
    z-index: -1;
    transition: transform 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: clamp(0.5rem, 1.1cqi, 1rem);
}

.cta-button-group:hover .cta-button-shadow {
    transform: translateX(clamp(0.25rem, 0.55cqi, 0.5rem))
        translateY(clamp(3rem, 7cqi, 4rem));
}

.cta-button-hint {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.1cqi, 1rem);
}

.cta-button-hint-icon {
    color: var(--color-primary);
    font-size: clamp(1.25rem, 3.5cqi, 2.25rem);
    line-height: 1;
}

.cta-button-hint-text {
    font-size: 8px;
    font-family: var(--font-mono-space);
    font-weight: 700;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    max-width: 140px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.25;
}

/* --- Footer --- */
.site-footer {
    padding: 1.5rem 3rem 3rem;
    position: relative;
    z-index: 10;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--color-black) 5rem
    );
    container-type: inline-size;
    container-name: footer;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: clamp(2rem, 5cqi, 4rem);
}

@media (min-width: 768px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.footer-brand-area {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
}

.footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo {
    width: clamp(1.75rem, 6cqi, 3rem);
    height: clamp(1.75rem, 6cqi, 3rem);
    object-fit: contain;
    transform: rotate(12deg);
    flex-shrink: 0;
}

.footer-title {
    font-size: clamp(1.25rem, 5.5cqi, 2.25rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    font-style: italic;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: clamp(1rem, 3.5cqi, 2.5rem);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--color-slate-600);
}

.footer-link {
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--color-primary);
}

.footer-link--underline {
    text-decoration: underline;
    text-decoration-color: rgba(123, 70, 255, 0.4);
    text-underline-offset: 3px;
}

.footer-meta {
    text-align: right;
}

.footer-meta-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6em;
    color: var(--color-slate-700);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.footer-meta-copyright {
    font-size: 0.75rem;
    font-family: var(--font-mono-space);
    color: var(--color-slate-500);
}

/* --- Audience Row --- */
.audience-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 3rem 0 0;
    position: relative;
    z-index: 10;
}

.audience-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(123, 70, 255, 0.4);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    z-index: 10;
    padding: 1rem 2rem;
    overflow-x: clip;
}

.section-inner {
    max-width: 900px;
    margin: 0 auto;
}

.section-inner--wide {
    max-width: 1200px;
}

.section-heading {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    border-left: 4px solid var(--color-primary);
    padding-left: 1rem;
    margin-bottom: 3rem;
    line-height: 1;
    transform: rotate(-1deg);
    display: inline-block;
}

/* --- Section A: What Does It Do --- */
.what-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.what-section-body p {
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.what-section-body p.accent {
    color: var(--color-primary);
}

/* --- Section B: How It Works --- */
.how-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.how-step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-number {
    font-size: clamp(3rem, 8vw, 5rem);
    font-family: var(--font-mono-space);
    font-weight: 700;
    color: transparent;
    -webkit-text-stroke: 2px var(--color-primary);
    line-height: 1;
    flex-shrink: 0;
    width: 2.5ch;
}

.step-text {
    padding-top: 0.75rem;
}

.step-text strong {
    display: block;
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    margin-bottom: 0.35rem;
    color: var(--color-white);
}

.step-text p {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
}

.how-disclaimer {
    font-size: 11px;
    font-family: var(--font-mono-space);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

/* --- Section C: Live Example --- */
.example-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 768px) {
    .example-layout {
        grid-template-columns: 1fr 2fr;
    }
}

.example-input .input-card {
    padding: 0;
    align-items: flex-start;
}

.example-mutations {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mutation-card {
    padding: 1.25rem;
    background: var(--primary-gradient);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    border-radius: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.mutation-label {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.6rem;
    letter-spacing: 0.4em;
}

.mutation-text {
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    font-weight: 700;
    line-height: 1.4;
    font-style: italic;
    letter-spacing: -0.02em;
}

.example-closer {
    text-align: center;
    margin-top: 2.5rem;
    font-size: 0.9rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.05em;
}

/* --- Section D: Personality Grid --- */
.personality-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.personality-pill {
    font-family: var(--font-mono-space);
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-white);
    border: 1px solid rgba(123, 70, 255, 0.6);
    padding: 0.5rem 1rem;
    transform: skewX(-4deg);
    display: inline-block;
    transition: background 0.2s ease;
}

.personality-pill:hover {
    background: rgba(123, 70, 255, 0.2);
}

.personality-disclaimer {
    font-size: 0.8rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.35);
}

/* --- Section E: Where This Breaks Things --- */
.breaks-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.breaks-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.breaks-item:nth-child(odd) {
    color: var(--color-primary);
}

.breaks-item::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    align-self: center;
}

.breaks-disclaimer {
    font-size: 11px;
    font-family: var(--font-mono-space);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

/* --- Section F: Final CTA --- */
.final-cta-section {
    position: relative;
    z-index: 20;
    padding: 5rem 2rem 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: clip;
    text-align: center;
}

.final-cta-heading {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    line-height: 0.9;
    margin-bottom: 4rem;
    transform: rotate(-2deg);
    color: var(--color-white);
}

.final-cta-disclaimer {
    margin-top: 4rem;
    font-family: var(--font-mono-space);
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    line-height: 2.2;
}
