/* ==========================================================================
   The Institute Project — Stylesheet
   Aesthetic: Editorial tech-magazine, dark with warm copper accents
   ========================================================================== */

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

:root {
    /* Color System */
    --bg-deep:       #0a0c10;
    --bg-surface:    #12151c;
    --bg-card:       #181c25;
    --bg-elevated:   #1e2330;
    
    --text-primary:  #e8e6e1;
    --text-secondary:#9a9690;
    --text-muted:    #5c5955;
    
    --accent:        #c8875a;
    --accent-light:  #dba478;
    --accent-glow:   rgba(200, 135, 90, 0.15);
    
    --border:        rgba(255, 255, 255, 0.06);
    --border-hover:  rgba(255, 255, 255, 0.12);
    
    /* Typography */
    --font-display:  'DM Serif Display', Georgia, serif;
    --font-body:     'Outfit', -apple-system, sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
    
    /* Spacing Scale */
    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  2rem;
    --space-lg:  4rem;
    --space-xl:  6rem;
    --space-2xl: 10rem;
    
    /* Layout */
    --container: 1200px;
    --nav-height: 72px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Base --- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-deep);
}

::selection {
    background: var(--accent);
    color: var(--bg-deep);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.3s var(--ease-out);
}

a:hover {
    color: var(--accent);
}

/* --- Layout --- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section {
    padding: var(--space-xl) 0;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
}

h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    margin-bottom: var(--space-md);
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: var(--space-sm);
}

p {
    max-width: 640px;
    color: var(--text-secondary);
}

p + p {
    margin-top: var(--space-sm);
}

em {
    font-style: italic;
    color: var(--accent-light);
}

/* --- Section Tag --- */
.section-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.section-tag::before {
    content: '';
    display: block;
    width: 24px;
    height: 1px;
    background: var(--accent);
}

/* --- Split Layout --- */
.split {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.split-label {
    padding-top: 0.35rem;
}

@media (max-width: 768px) {
    .split {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.35s var(--ease-out);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-deep);
}

.btn-primary:hover {
    background: var(--accent-light);
    color: var(--bg-deep);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(200, 135, 90, 0.25);
}

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

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 100;
    transition: background 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.nav.scrolled {
    background: rgba(10, 12, 16, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--space-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-mark {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--bg-deep);
    background: var(--accent);
    padding: 0.3rem 0.55rem;
    border-radius: 4px;
}

.logo-text {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

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

.nav-links a {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    transition: color 0.3s var(--ease-out);
}

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

.nav-links .nav-cta {
    background: var(--accent);
    color: var(--bg-deep);
    padding: 0.5rem 1.25rem;
    border-radius: 5px;
    font-weight: 500;
}

.nav-links .nav-cta:hover {
    background: var(--accent-light);
    color: var(--bg-deep);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s var(--ease-out);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(10, 12, 16, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: var(--space-md);
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 99;
    border-bottom: 1px solid var(--border);
}

.mobile-menu a {
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

.mobile-menu.open {
    display: flex;
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-toggle { display: flex; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + var(--space-lg)) var(--space-md) var(--space-lg);
    overflow: hidden;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(200, 135, 90, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 135, 90, 0.04) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse at 50% 40%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, black 20%, transparent 70%);
}

.hero::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 800px;
    text-align: center;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--space-md);
    opacity: 0;
    animation: fadeUp 0.8s var(--ease-out) 0.2s forwards;
}

.hero-title {
    margin-bottom: var(--space-md);
    opacity: 0;
    animation: fadeUp 0.8s var(--ease-out) 0.4s forwards;
}

.hero-sub {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-md);
    opacity: 0;
    animation: fadeUp 0.8s var(--ease-out) 0.6s forwards;
}

.hero-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeUp 0.8s var(--ease-out) 0.8s forwards;
}

.hero-scroll-hint {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fadeIn 1s var(--ease-out) 1.5s forwards;
}

.hero-scroll-hint span {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scrollPulse 2s var(--ease-out) infinite;
}

/* ==========================================================================
   Principles
   ========================================================================== */
.section-principles {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.principle-card {
    background: var(--bg-card);
    padding: var(--space-md);
    transition: background 0.4s var(--ease-out);
}

.principle-card:hover {
    background: var(--bg-elevated);
}

.principle-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: var(--space-sm);
}

.principle-card h3 {
    color: var(--text-primary);
}

.principle-card p {
    font-size: 0.925rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Articles
   ========================================================================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
    transition: all 0.4s var(--ease-out);
    text-decoration: none;
    display: block;
}

.article-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.article-card--placeholder {
    border-style: dashed;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.article-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
}

.article-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.article-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.articles-more {
    text-align: center;
}

/* ==========================================================================
   Connect / Newsletter
   ========================================================================== */
.section-connect {
    padding: var(--space-2xl) 0;
}

.connect-box {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.connect-box h2 {
    margin-bottom: var(--space-sm);
}

.connect-box > p {
    margin: 0 auto var(--space-md);
    text-align: center;
}

.connect-form {
    margin: 0 auto;
}

.form-group {
    display: flex;
    gap: 0.5rem;
    max-width: 460px;
    margin: 0 auto var(--space-xs);
}

.form-group input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s var(--ease-out);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.connect-success p {
    color: var(--accent-light);
    font-weight: 500;
}

@media (max-width: 480px) {
    .form-group {
        flex-direction: column;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    border-top: 1px solid var(--border);
    padding: var(--space-lg) 0 var(--space-md);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--space-lg);
    align-items: start;
}

.footer-brand .logo-mark {
    display: inline-block;
    margin-bottom: var(--space-sm);
}

.footer-brand p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 280px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

.footer-copy p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: none;
}

@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .footer-copy {
        text-align: left;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.2); }
}

/* Scroll-triggered fade-in (applied via JS) */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

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