/**
 * Hollow Sail Styles — Phase 3.21 — True Dithered Radial Wipe
 */

:root {
    --bg: #050505;
    --surface: #0a0a0a;
    --surface-alt: #0f0f0f;
    --border: #2a2a2a;
    --border-bright: #666666;
    --text-primary: #e8e6e3;
    --text-muted: #7a7773;
    --accent: #829c82; /* Faded darker green default */
    --accent-hover: #d4a5a5; /* Faded pink on hover / target */
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* DELETED: Global Ordered Dither Pattern (body::before) was completely removed from index page */

/* About Page: 3-Layer Edge Consumption + Zoomed Cursor Torch + Center Hole (PROTECTED & UNTOUCHED) */
body.about-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 4 4' width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23000' fill-opacity='0.9'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%23000' fill-opacity='0.6'/%3E%3Crect x='1' y='2' width='1' height='1' fill='%23000' fill-opacity='0.8'/%3E%3Crect x='3' y='3' width='1' height='1' fill='%23000' fill-opacity='1.0'/%3E%3C/svg%3E");
    background-size: 6px 6px;
    opacity: 1.0;
    mask-image: radial-gradient(circle 350px at var(--torch-x, 50%) var(--torch-y, 50%), rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%),
                radial-gradient(circle 650px at 50% 50%, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);
    -webkit-mask-image: radial-gradient(circle 350px at var(--torch-x, 50%) var(--torch-y, 50%), rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%),
                       radial-gradient(circle 650px at 50% 50%, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
    transition: opacity 0.3s ease;
}

body.about-body.soft-dither::before {
    opacity: 0.15; /* Much softer, more transparent version of pure dither when toggled */
}

/* Edge Consumption Vignette Layer (Darkens edges permanently) */
body.about-body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 997;
    background: radial-gradient(circle at 50% 50%, rgba(5,5,5,0) 30%, rgba(5,5,5,0.95) 85%, rgba(5,5,5,1) 100%);
    mix-blend-mode: multiply;
}

/* Pure Ordered Dither Experimental Mask Canvas */
#pixel-mask-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
    image-rendering: pixelated;
    display: none;
}
body.pixel-mask #pixel-mask-canvas {
    display: block;
}

/* Site Wrapper */
.site-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 0;
    position: relative;
    z-index: 2;
}

/* Edge-to-edge horizontal bars/lines and headers */
.site-header, .hero-section, .section-header, .content-section, .site-footer, .animated-rule {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    box-sizing: border-box;
}

/* Header & Spread Navigation (2px thick top/left border bevel) */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
    background: var(--surface-alt);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.2em;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-mark {
    color: var(--accent);
    font-size: 1.3rem;
}

.site-nav {
    display: flex;
    justify-content: space-between;
    gap: 3rem;
    flex-grow: 1;
    max-width: 700px;
    margin-left: 5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-top: 2px solid transparent;
    border-left: 2px solid transparent;
}

.nav-link::before {
    content: "> ";
    color: var(--accent-hover);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-hover);
    border-top: 2px solid var(--accent-hover);
    border-left: 2px solid var(--accent-hover);
    background: var(--surface);
}

.nav-link:hover::before, .nav-link.active::before {
    opacity: 1;
}

/* Hero Section */
.hero-section {
    margin-bottom: 3.5rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.cli-meta {
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.15em;
    opacity: 0.9;
}

.animated-rule {
    height: 1px;
    background: linear-gradient(90deg, var(--accent), var(--border), transparent);
    width: 100vw;
    margin-top: 2rem;
}

/* Content Sections */
.content-section {
    margin-bottom: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--border);
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 2.5rem;
    background: var(--surface-alt);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
}

.section-header h2 {
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    color: var(--text-primary);
}

.section-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

/* Work Grid Cards — 2px Bevel */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2.5rem;
    padding-left: 0;
    padding-right: 0;
}

.portfolio-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease;
}

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

/* Terminal Card Header */
.card-terminal-header {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.card-terminal-header .dot {
    color: var(--accent);
}

.card-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    cursor: pointer;
}

.card-thumb-wrap img, .thumb-torch {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.thumb-original {
    z-index: 1;
}

.thumb-torch {
    z-index: 2;
    pointer-events: none;
    display: none;
}

.thumb-dither {
    z-index: 3;
    visibility: visible;
}

.card-thumb-wrap.is-animating .thumb-torch {
    display: block;
}

.card-thumb-wrap.is-animating .thumb-dither,
.card-thumb-wrap.is-revealed .thumb-dither {
    visibility: hidden;
}

.card-meta {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
}

.card-meta h3 {
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: 0.1em;
}

.card-meta p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.card-btn {
    background: var(--surface);
    color: var(--accent);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.card-btn:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    color: var(--bg);
}

.card-tag {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

/* Modal for YouTube Embed */
.video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    aspect-ratio: 16/9;
    background: #000;
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
}

.modal-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: var(--surface-alt);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
    color: var(--accent-hover);
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    letter-spacing: 0.1em;
}

/* About & Artifact Pages */
.page-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem;
}

.terminal-box {
    background: var(--surface);
    border-top: 2px solid var(--border-bright);
    border-left: 2px solid var(--border-bright);
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.terminal-body {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.8;
}

.terminal-body p {
    margin-bottom: 1.2rem;
}

.cursed-text {
    color: var(--accent-hover);
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    padding-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    background: var(--surface-alt);
}

.footer-note {
    font-style: italic;
    color: var(--accent);
    opacity: 0.9;
}

.footer-note span:hover {
    color: var(--accent-hover);
}

/* Responsive */
@media (max-width: 900px) {
    .site-wrapper, .page-container {
        padding: 1rem;
    }
    .site-header, .hero-section, .section-header, .content-section, .site-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .site-nav {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        gap: 1.5rem;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .site-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
