/* ═══════════════════════════════════════
   Garry Landing — Dark Terminal × Pixel Art
   ═══════════════════════════════════════ */

:root {
    --bg: #06060e;
    --bg-card: #0f1020;
    --bg-card-hover: #12122a;
    --text: #f0f0f8;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --accent: #ff6b6b;
    --accent-2: #4ecdc4;
    --accent-3: #ffd166;
    --accent-4: #ff9e6d;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Grain Overlay ── */
.grain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px;
}

/* ── Cursor Glow ── */
.cursor-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.18) 0%, rgba(78, 205, 196, 0.08) 40%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    will-change: left, top;
}

/* ── Navigation ── */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1.25rem 0;
    background: rgba(6, 6, 14, 0);
    backdrop-filter: blur(0px);
    transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), border-color 0.4s;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: rgba(6, 6, 14, 0.85);
    backdrop-filter: blur(12px);
    border-bottom-color: var(--border);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.3rem;
}

.logo-icon { font-size: 1.6rem; }

.logo-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.3s var(--ease);
}

.nav-links a:hover { color: var(--text); }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    flex-direction: column;
    justify-content: space-between;
}

.menu-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.3s;
}

/* ── Hero ── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 6rem 0 4rem;
}

.hero-bg-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(255, 107, 107, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(78, 205, 196, 0.09) 0%, transparent 60%),
        radial-gradient(ellipse 50% 30% at 50% 20%, rgba(255, 209, 102, 0.06) 0%, transparent 60%);
    animation: meshShift 12s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0%   { transform: scale(1) translate(0, 0); }
    50%  { transform: scale(1.05) translate(-2%, 1%); }
    100% { transform: scale(1) translate(1%, -1%); }
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-label {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.hero-title .scramble-text {
    display: block;
}

.hero-title .scramble-text:last-child {
    background: linear-gradient(135deg, var(--accent), var(--accent-4), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 90%;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: var(--accent);
    color: var(--bg);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Terminal */
.terminal {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-hover);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(255, 107, 107, 0.05);
}

.terminal-header {
    background: #111;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot:nth-child(1) { background: #ff5f56; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #27ca3f; }

.terminal-title {
    margin-left: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.8rem;
}

.terminal-body {
    padding: 1.25rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.7;
    min-height: 260px;
    position: relative;
}

.terminal-lines {
    color: var(--accent-2);
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-cursor {
    animation: cursorBlink 1s step-end infinite;
    color: var(--accent);
    font-weight: 600;
}

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

/* ── Sections ── */
.section {
    padding: 8rem 0;
    position: relative;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 3.5rem;
    line-height: 1.2;
}

.section-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

/* ── Projects ── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 2rem;
}

/* Force link reset on project card — Safari mobile fix */
a.project-card,
a.project-card:visited,
a.project-card:active {
    text-decoration: none;
    color: var(--text);
    -webkit-text-decoration: none;
}

a.project-card * {
    text-decoration: none;
}

.project-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: border-color 0.4s var(--ease), transform 0.3s var(--ease);
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 800px;
}

.project-card:hover {
    border-color: var(--border-hover);
}

.project-card-glow {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
    background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), rgba(255, 107, 107, 0.08) 0%, transparent 60%);
}

.project-card:hover .project-card-glow {
    opacity: 1;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.project-pet-preview {
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
}

.project-pet-preview canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    width: 96px;
    height: 96px;
}

.project-icon-large {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: 8px;
}

.project-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.05em;
}

.project-status-badge.live {
    background: rgba(78, 205, 196, 0.12);
    color: var(--accent-2);
}

.project-status-badge.planned {
    background: rgba(255, 209, 102, 0.12);
    color: var(--accent-3);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 2s ease infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.project-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.meta-tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.project-cta {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-cta .arrow {
    transition: transform 0.3s var(--ease-spring);
}

.project-card:hover .project-cta .arrow {
    transform: translateX(4px);
}

.coming-soon {
    opacity: 0.5;
    cursor: default;
}

/* ── Method ── */
.method-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.method-step {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s, transform 0.3s var(--ease);
}

.method-step:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.method-number {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.3;
    margin-bottom: 0.75rem;
}

.method-step h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.method-step p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.method-quote {
    text-align: center;
    padding: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
}

.method-quote blockquote {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto 1rem;
}

.method-badge {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--accent-3);
    text-transform: uppercase;
}

/* ── Stack Grid ── */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stack-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s, transform 0.3s var(--ease);
}

.stack-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.stack-card-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.stack-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.stack-card p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
}

.stack-footnote {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── Footer ── */
.footer {
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
}

.footer-content {
    text-align: center;
    margin-bottom: 2rem;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 800;
    font-size: 1.2rem;
}

.footer-tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-links {
    display: inline-flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s;
    white-space: nowrap;
}

.footer-links a:hover { color: var(--accent-2); }

.footer-sep { color: var(--text-muted); font-size: 0.7rem; }

.footer-bottom {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ── Reveal Animations ── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }

/* ── Tablet ── */
@media (max-width: 992px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-subtitle { max-width: 100%; }
    .hero-actions { justify-content: center; }
    .hero-label { text-align: center; }

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

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

/* ── Mobile ── */
@media (max-width: 768px) {
    .nav-links { display: none; }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(6, 6, 14, 0.95);
        backdrop-filter: blur(12px);
        padding: 1.5rem 2rem;
        gap: 1.25rem;
        border-bottom: 1px solid var(--border);
    }

    .menu-toggle { display: flex; }

    .hero {
        padding: 6rem 0 2rem;
        min-height: auto;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        max-width: 100%;
    }

    .hero-subtitle br { display: none; }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-pet-preview canvas {
        width: 72px;
        height: 72px;
    }

    .project-icon-large {
        width: 72px;
        height: 72px;
        font-size: 2rem;
    }

    .project-name { font-size: 1.25rem; }
    .project-desc { font-size: 0.9rem; }
    .project-card { padding: 1.5rem; }

    .method-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .method-step { padding: 1.25rem; }
    .method-number { font-size: 1.5rem; }
    .method-step h3 { font-size: 1rem; }
    .method-step p { font-size: 0.8rem; }

    .method-quote {
        padding: 1.25rem;
    }

    .method-quote blockquote {
        font-size: 0.85rem;
    }

    .stack-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stack-card { padding: 1rem; }
    .stack-card-icon { font-size: 1.3rem; margin-bottom: 0.5rem; }
    .stack-card h3 { font-size: 0.85rem; }
    .stack-card p { font-size: 0.7rem; }

    .section {
        padding: 4rem 0;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    .section-label {
        font-size: 0.65rem;
    }

    .cursor-glow { display: none; }

    .terminal-body {
        min-height: 180px;
        padding: 1rem;
        font-size: 0.7rem;
    }

    .btn-primary {
        padding: 0.8rem 1.5rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }

    .footer-content { margin-bottom: 1rem; }
    .footer-tagline { font-size: 0.8rem; }
    .footer-bottom { font-size: 0.7rem; }
}

/* ── Small phones ── */
@media (max-width: 380px) {
    .hero-title { font-size: 1.7rem; }

    .method-grid { grid-template-columns: 1fr; }

    .stack-grid { grid-template-columns: 1fr; }

    .terminal { display: none; }

    .section-title { font-size: 1.3rem; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .cursor-glow { display: none; }
    .hero-bg-mesh { animation: none; }
}
