/* =============================================
   EdgeCase.nz — Styles
   Typography: Poppins (headings/logo) + IBM Plex Sans (body)
   Palette: Monochromatic teal + coral accent
   ============================================= */

:root {
    --teal: #006666;
    --teal-dark: #004d4d;
    --teal-light: #1a7b7b;
    --coral: #ff6b6b;
    --coral-dark: #e85555;
    --off-white: #F9F9F9;
    --text-dark: #1C1C1E;
    --text-medium: #2c3e50;
    --gray-light: #d1d5db;
    --scroll-duration: 0.9s;
}

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

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
        scroll-snap-type: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    background-color: var(--off-white);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Poppins', 'IBM Plex Sans', sans-serif;
    font-weight: 600;
}

/* =============================================
   Skip Navigation Link
   ============================================= */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background-color: var(--teal);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    z-index: 9999;
}

.skip-link:focus {
    top: 0;
}

/* =============================================
   Focus Indicators
   ============================================= */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--coral);
    outline-offset: 2px;
}

a:focus:not(:focus-visible) {
    outline: none;
}

a:focus-visible {
    outline: 3px solid var(--coral);
    outline-offset: 2px;
}

/* =============================================
   Navigation
   ============================================= */
nav {
    background-color: var(--teal);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.nav-links-desktop {
    display: flex;
    gap: 3rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: opacity 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link:focus {
    opacity: 0.8;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--coral);
}

/* Mobile hamburger — hidden on desktop */
.nav-mobile {
    display: none;
    position: relative;
}

.nav-dropdown-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    position: relative;
    transition: background-color 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: white;
    left: 0;
    transition: transform 0.3s ease;
}

.hamburger-icon::before {
    top: -7px;
}

.hamburger-icon::after {
    top: 7px;
}

.nav-dropdown-toggle[aria-expanded="true"] .hamburger-icon {
    background-color: transparent;
}

.nav-dropdown-toggle[aria-expanded="true"] .hamburger-icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-dropdown-toggle[aria-expanded="true"] .hamburger-icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    margin-top: 0.75rem;
}

.nav-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-dropdown-link:hover,
.nav-dropdown-link:focus {
    background-color: var(--off-white);
    color: var(--teal);
}

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

section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* =============================================
   HERO SECTION — Centred, stacked: logo → name → tagline
   ============================================= */
#hero {
    padding: 4rem 0;
    width: 100%;
    text-align: center;
}

#hero .container {
    width: 100%;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-logo {
    max-width: 420px;
    width: 100%;
    height: auto;
    margin-bottom: 2rem;
}

.hero-content h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.hero-location {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1.15rem;
    color: var(--teal);
    font-weight: 500;
    margin: 0 0 1.5rem;
}

.hero-tagline {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-medium);
    max-width: 600px;
}

/* =============================================
   ACCENT LINES — Animated, alternating sides, coral
   Breaks out of container to start from viewport edge.
   Grows to align with the end of the section heading.
   Synced with scroll-snap timing (0.9s)
   
   JS sets two custom properties on each line:
     --line-offset: how far to shift to reach viewport edge
     --line-target-width: how wide the line needs to grow
   ============================================= */
.accent-line {
    height: 4px;
    background-color: transparent;
    margin: 1rem 0 2.5rem 0;
    position: relative;
    overflow: visible;
}

.accent-line::after {
    content: '';
    position: absolute;
    top: 0;
    height: 4px;
    background-color: var(--coral);
    width: 0;
    transition: width var(--scroll-duration) cubic-bezier(0.37, 0, 0.63, 1);
}

/* Lines that grow from the left viewport edge */
.accent-line--left::after {
    left: var(--line-offset, 0);
}

/* Lines that grow from the right viewport edge */
.accent-line--right::after {
    right: var(--line-offset, 0);
}

/* When visible, grow to target width */
.accent-line.is-visible::after {
    width: var(--line-target-width, 40vw);
}

/* =============================================
   ABOUT SECTION — Photo left, text right
   ============================================= */
#about {
    padding-top: 2rem;
    padding-bottom: 2rem;
    width: 100%;
}

#about .container {
    width: 100%;
}

#about h2 {
    font-size: 2.5rem;
    color: var(--teal);
    text-align: center;
    margin-bottom: 0.5rem;
}

.about-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    align-items: start;
}

.about-image {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--gray-light);
    border: 4px solid var(--coral);
    flex-shrink: 0;
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-text {
    max-width: 800px;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-medium);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* CV PDF download link */
.cv-pdf-link {
    display: inline-block;
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    border-bottom: 2px solid transparent;
}

.cv-pdf-link:hover {
    color: var(--coral);
    border-bottom-color: var(--coral);
}

/* =============================================
   PROJECTS — Full-viewport per project
   ============================================= */
.project-section {
    width: 100%;
    padding: 3rem 0;
}

.project-section h2 {
    font-size: 2.5rem;
    color: var(--teal);
    text-align: center;
    margin-bottom: 0.5rem;
}

.project-section .accent-line {
    max-width: 300px;
    margin-bottom: 3rem;
}

/* Projects accent line direction handled by --right class */

.project-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.project-card:hover,
.project-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.placeholder-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--teal-dark);
}

.placeholder-content p {
    color: var(--off-white);
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    padding: 2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.project-link {
    text-decoration: none;
    color: inherit;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 65vh;
}

.project-link:focus {
    outline: 3px solid var(--coral);
    outline-offset: 2px;
}

.project-image {
    width: 100%;
    height: 100%;
    min-height: 65vh;
    background-color: var(--gray-light);
}

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

.project-card h3 {
    font-size: 2rem;
    color: var(--teal);
    margin-bottom: 1rem;
}

.project-summary {
    color: var(--text-medium);
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.project-cta {
    display: inline-block;
    color: var(--coral);
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.2s ease;
}

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

/* =============================================
   CONTACT SECTION
   ============================================= */
#contact {
    padding: 0;
    width: 100%;
    justify-content: space-between;
    position: relative;
}

.contact-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

#contact h2 {
    font-size: 2.5rem;
    color: var(--teal);
    text-align: center;
    margin-bottom: 0.5rem;
}

#contact .accent-line {
    /* Handled by --left/--right classes and JS measurement */
}

.contact-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.contact-content p {
    font-size: 1.15rem;
    color: var(--text-medium);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.contact-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2.5rem;
}

.contact-button {
    background-color: var(--teal);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;
}

.contact-button:hover {
    background-color: var(--coral);
    transform: translateY(-2px);
}

.contact-button:focus {
    outline: 3px solid var(--coral);
    outline-offset: 3px;
}

/* =============================================
   FOOTER (inside contact section)
   ============================================= */
#contact footer {
    background-color: var(--teal);
    color: white;
    padding: 2rem 0;
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 0 2rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-tagline {
    font-style: italic;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Standalone footer for sub-pages */
footer[role="contentinfo"] {
    background-color: var(--teal);
    color: white;
    padding: 2rem 0;
    width: 100%;
}

/* =============================================
   CTA Button (shared)
   ============================================= */
.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--teal);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: var(--coral);
    transform: translateY(-2px);
}

/* =============================================
   RESPONSIVE — Tablet
   ============================================= */
@media (max-width: 1024px) {
    .hero-logo {
        max-width: 360px;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .about-image {
        width: 280px;
        height: 280px;
    }

    .about-content {
        gap: 2rem;
    }
}

/* =============================================
   RESPONSIVE — Mobile
   ============================================= */
@media (max-width: 768px) {
    /* Nav: hide desktop links, show hamburger */
    .nav-links-desktop {
        display: none;
    }

    .nav-mobile {
        display: block;
        margin-left: auto;
    }

    .nav-container {
        justify-content: flex-end;
    }

    /* Sections don't need full viewport on mobile */
    section {
        min-height: auto;
        padding: 4rem 0;
    }

    /* Hero: already centred, just scale down */
    .hero-logo {
        max-width: 280px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-location {
        font-size: 1.05rem;
    }

    .hero-tagline {
        font-size: 1rem;
    }

    /* About: stack photo above text */
    #about h2 {
        text-align: center;
    }

    .about-content {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .about-image {
        width: 240px;
        height: 240px;
    }

    .about-text {
        text-align: center;
    }

    .accent-line--left,
    .accent-line--right {
        margin-left: auto;
        margin-right: auto;
    }

    /* On mobile, reset accent lines to simple centered bars */
    .accent-line--left::after,
    .accent-line--right::after {
        position: relative;
        left: auto;
        right: auto;
        display: block;
        margin: 0 auto;
    }

    .accent-line.is-visible::after {
        width: 200px;
    }

    .cv-pdf-link {
        display: block;
        text-align: center;
    }

    /* Projects: stack */
    .project-link {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .project-image {
        min-height: 35vh;
    }

    .project-info {
        padding: 2rem;
    }

    .project-card h3 {
        font-size: 1.5rem;
    }

    /* Contact */
    .contact-links {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .nav-container {
        gap: 1.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .about-image {
        width: 180px;
        height: 180px;
    }

    .hero-logo {
        max-width: 220px;
    }

    .hero-content h1 {
        font-size: 1.75rem;
    }
}

/* =============================================
   Portfolio Detail / Case Study Pages
   ============================================= */
.case-study {
    min-height: auto;
    display: block;
    padding: 0 0 4rem;
}

.back-link {
    display: inline-block;
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 1.5rem 0;
    transition: color 0.2s ease;
}

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

.case-study-hero {
    width: 100%;
    margin-bottom: 3rem;
}

.case-study-hero-image {
    width: 100%;
    height: 400px;
    background-color: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-study-header {
    margin-bottom: 3rem;
}

.case-study-header h1 {
    font-size: 2.5rem;
    color: var(--teal);
    margin-bottom: 0.5rem;
}

.case-study-header .accent-line {
    background-color: var(--coral);
    width: 200px;
    margin-left: 0;
}

.case-study-header .accent-line::after {
    display: none;
}

.case-study-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.case-study-meta dt {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--coral);
    margin-bottom: 0.25rem;
}

.case-study-meta dd {
    margin: 0;
    color: var(--text-dark);
    font-size: 1rem;
}

.case-study-body {
    max-width: 800px;
}

.case-study-body section {
    min-height: auto;
    display: block;
    padding: 0;
    margin-bottom: 3rem;
}

.case-study-body h2 {
    font-size: 1.75rem;
    color: var(--teal);
    margin-bottom: 1rem;
    text-align: left;
}

.case-study-body p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-medium);
    margin-bottom: 1.25rem;
}

.case-study-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3rem 0 2rem;
    border-top: 2px solid var(--gray-light);
    margin-top: 4rem;
}

.case-study-nav-link {
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.case-study-nav-link:hover {
    color: var(--coral);
}

.case-study-nav-link.all {
    padding: 0.75rem 1.5rem;
    background: var(--teal);
    color: white;
    border-radius: 4px;
}

.case-study-nav-link.all:hover {
    background: var(--coral);
    color: white;
}

/* Case study responsive */
@media (max-width: 768px) {
    .case-study-hero-image {
        height: 250px;
    }

    .case-study-header h1 {
        font-size: 2rem;
    }

    .case-study-meta {
        grid-template-columns: 1fr 1fr;
    }

    .case-study-nav {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .case-study-meta {
        grid-template-columns: 1fr;
    }
}
