/* ==========================================================================
   Porto-Fino Portfolio Styles
   ========================================================================== */

/* ==========================================================================
   CSS Variables & Theme
   ========================================================================== */
:root {
    --bg-primary: #FDFBF7;
    --bg-secondary: #F5F1EA;
    --bg-tertiary: #EBE6DC;
    --text-primary: #1a1a1a;
    --text-secondary: #555;
    --text-tertiary: #888;
    --accent: #2D4A3E;
    --accent-hover: #1E342B;
    --border: #E5E0D5;
    --card-bg: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-secondary: #1a1a1a;
        --bg-tertiary: #222;
        --text-primary: #F5F1EA;
        --text-secondary: #a0a0a0;
        --text-tertiary: #707070;
        --accent: #5B8A72;
        --accent-hover: #7AAD91;
        --border: #2a2a2a;
        --card-bg: #1a1a1a;
    }
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.container-narrow {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ==========================================================================
   Header
   ========================================================================== */
header {
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    z-index: 100;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, backdrop-filter 0.3s ease;
}

header.scrolled {
    border-bottom-color: var(--border);
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
}

@media (prefers-color-scheme: dark) {
    header.scrolled {
        background: rgba(18, 18, 18, 0.9);
    }
}

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

/* Logo */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

/* Navigation */
nav {
    display: flex;
    gap: 2.5rem;
}

nav a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
}

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

/* Back Link (Case Studies) */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.back-link svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Hero Section (Homepage)
   ========================================================================== */
.hero {
    padding: 10rem 0 6rem;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-content {
    max-width: 800px;
}

.hero h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2.75rem, 5.5vw, 4rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero h1 .accent {
    color: var(--accent);
    font-style: italic;
}

.hero h1 .code-indent {
    display: inline-block;
    padding-left: 1.5ch;
}

.hero-label {
    display: inline-block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 580px;
    line-height: 1.7;
    margin-bottom: 2rem;
}

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

.hero-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-meta .dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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

/* ==========================================================================
   Projects Section (Homepage)
   ========================================================================== */
.projects-section {
    padding: 4rem 0 8rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.section-count {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Project Cards */
.projects-grid {
    display: grid;
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.project-card:nth-child(even) {
    direction: rtl;
}

.project-card:nth-child(even) > * {
    direction: ltr;
}

.project-image {
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    min-height: 400px;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card .project-image img {
    object-position: top left;
}

.project-card:hover .project-image img {
    transform: scale(1.03);
}

.project-content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 500;
}

.project-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

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

.tag {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.2s ease;
}

.project-link:hover {
    gap: 0.75rem;
}

.project-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.project-link:hover svg {
    transform: translateX(2px);
}

/* Compact Project Cards (Secondary) */
.projects-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.project-card-compact {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.project-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

.project-card-compact .project-image {
    min-height: 220px;
}

.project-card-compact .project-content {
    padding: 1.5rem;
}

.project-card-compact .project-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.project-card-compact .project-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   About Section (Homepage)
   ========================================================================== */
.about-section {
    padding: 6rem 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
}

.about-label {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.1rem;
    color: var(--text-tertiary);
}

.about-content h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.about-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 600px;
}

.experience-list {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.experience-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.experience-role {
    font-weight: 500;
}

.experience-company {
    color: var(--text-secondary);
}

.experience-years {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 6rem 0 3rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.footer-cta {
    text-align: center;
    max-width: 500px;
    margin: 0 auto 3rem;
}

.footer-label {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.footer-headline {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    font-style: italic;
}

.footer-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.footer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.footer-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.footer-copyright {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* Footer - Simple (Case Studies) */
footer.footer-simple {
    padding: 3rem 0;
}

/* ==========================================================================
   Case Study Styles
   ========================================================================== */

/* Case Hero */
.case-hero {
    padding: 8rem 0 0;
}

.case-hero-content {
    max-width: 800px;
}

.case-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.case-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.case-meta-label {
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
}

.case-meta-value {
    color: var(--text-primary);
}

.case-hero h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.case-hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 650px;
    line-height: 1.7;
}

/* Hero Image */
.case-hero-image {
    margin: 4rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.case-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Hero Visual (Text-only case studies) */
.case-hero-visual {
    margin: 4rem 0;
    padding: 5rem 3rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 12px;
    text-align: center;
    color: white;
}

.case-hero-visual .big-number {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 6rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.case-hero-visual .big-label {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Content Sections */
.case-section {
    padding: 4rem 0;
}

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

.case-section h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.case-section p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.case-section p:last-child {
    margin-bottom: 0;
}

.case-section ul {
    color: var(--text-secondary);
    margin: 1rem 0 1.5rem 1.5rem;
    line-height: 1.8;
}

.case-section li {
    margin-bottom: 0.5rem;
}

/* Highlight Box */
.highlight-box {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.highlight-box p {
    margin-bottom: 0;
    font-style: italic;
}

/* Case Images */
.case-image {
    margin: 3rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.case-image img {
    width: 100%;
    height: auto;
    display: block;
}

.case-image-caption {
    padding: 1rem;
    background: var(--bg-secondary);
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-align: center;
}

.case-image-full {
    margin: 4rem 0;
}

.case-image-full .container {
    max-width: 1000px;
}

/* Before/After Comparison */
.before-after {
    margin: 3rem 0;
}

.before-after-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.before-after-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.before-after-label {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    font-weight: 500;
}

.before-after-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2.5rem;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 2rem 0;
}

.two-col h3 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 4rem 0;
}

/* Next Project */
.next-project {
    padding: 6rem 0;
    background: var(--bg-secondary);
    text-align: center;
}

.next-project-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.next-project h3 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.next-project a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.2s ease;
}

.next-project a:hover {
    gap: 0.75rem;
}

.next-project a svg {
    width: 16px;
    height: 16px;
}

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

.hero-content {
    animation: fadeInUp 0.8s ease forwards;
}

.project-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.project-card:nth-child(1) { animation-delay: 0.2s; }
.project-card:nth-child(2) { animation-delay: 0.35s; }

.project-card-compact {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.project-card-compact:nth-child(1) { animation-delay: 0.5s; }
.project-card-compact:nth-child(2) { animation-delay: 0.6s; }

.case-hero-content {
    animation: fadeInUp 0.8s ease forwards;
}

.case-hero-image {
    opacity: 0;
    animation: fadeInUp 0.8s ease 0.2s forwards;
}

.case-hero-visual {
    opacity: 0;
    animation: fadeInUp 0.8s ease 0.2s forwards;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 900px) {
    .project-card {
        grid-template-columns: 1fr;
    }

    .project-card:nth-child(even) {
        direction: ltr;
    }

    .project-image {
        min-height: 280px;
    }

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

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .case-meta {
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .before-after-grid {
        grid-template-columns: 1fr;
    }

    .container-narrow {
        padding: 0 1.5rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 1.25rem;
    }

    .hero {
        padding: 8rem 0 4rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    nav {
        gap: 1.5rem;
    }

    .project-content {
        padding: 2rem;
    }

    .project-stats {
        gap: 1.5rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-headline {
        font-size: 2rem;
    }
}
