/* John Maeda variation, in iA Writer Quattro.
   Quattro is a quasi-monospaced typeface from iA — slightly more
   proportional than mono but with the same drafting-table feel.
   Self-hosted from assets/fonts/ (downloaded from iaolo/iA-Fonts,
   SIL Open Font License). Used for everything: body, headings, UI
   chrome, and the * * * dividers. No second typeface, no fallback
   web font. */

@font-face {
    font-family: 'iA Writer Quattro';
    src: url('/assets/fonts/iAWriterQuattroS-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'iA Writer Quattro';
    src: url('/assets/fonts/iAWriterQuattroS-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'iA Writer Quattro';
    src: url('/assets/fonts/iAWriterQuattroS-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'iA Writer Quattro';
    src: url('/assets/fonts/iAWriterQuattroS-BoldItalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    --white: #ffffff;
    --black: #000000;
    --gray-90: #1a1a1a;
    --gray-50: #777777;
    --gray-20: #d6d6d6;
    --primary-color: var(--black);
    --text-color: var(--black);
    --text-light: var(--gray-50);
    --bg-color: var(--white);
    --bg-light: var(--white);
    --border-color: var(--gray-20);
    --shadow: none;
    --shadow-hover: none;
    --transition: color 0.15s linear, opacity 0.15s linear;
    --max-width: 880px;
    --spacing: 1rem;
    --spacing-lg: 2.5rem;
    --spacing-xl: 6rem;
    --sans: 'iA Writer Quattro', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --mono: 'iA Writer Quattro', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.55;
    color: var(--black);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    color: var(--black);
    text-decoration: none;
    transition: var(--transition);
}

a:hover { opacity: 0.5; }

ul { list-style: none; }

h1, h2, h3, h4 {
    font-family: var(--sans);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--black);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---------- Buttons (as text-arrow links) ---------- */

.btn {
    display: inline-block;
    padding: 0;
    font-family: var(--sans);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    border: 0;
    background: transparent;
    color: var(--black);
}

.btn::after {
    content: " →";
    margin-left: 0.25em;
}

.btn:hover { opacity: 0.5; }

.btn-primary,
.btn-secondary {
    background: transparent;
    color: var(--black);
    border: 0;
}

/* ---------- Nav ---------- */

.navbar {
    background-color: var(--white);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 2.75rem;
}

.nav-toggle {
    margin-left: auto;
}

.logo {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-menu {
    display: flex;
    gap: 1.75rem;
}

.nav-menu a {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--black);
}

.nav-menu a::after {
    content: " →";
    margin-left: 0.2em;
    opacity: 0.6;
}

.nav-menu a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: 0;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--black);
}

/* ---------- Hero ---------- */

.hero {
    padding: 4rem 0 5rem;
    text-align: left;
    background: var(--white);
    color: var(--black);
}

.hero .container { max-width: var(--max-width); }

.hero-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    align-items: stretch;
}

.hero-portrait {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    background: var(--gray-20);
}

.hero-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hero-text .hero-cta {
    margin-top: auto;
}

@media (max-width: 720px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .hero-portrait {
        max-width: 220px;
    }
}

.hero-title {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.85rem;
}

.hero-tagline {
    font-size: clamp(0.88rem, 1vw, 0.95rem);
    font-weight: 400;
    line-height: 1.5;
    max-width: 56ch;
    margin: 0 0 1.1rem;
    color: var(--black);
}

.hero-cta {
    display: flex;
    gap: 1.25rem;
    align-items: baseline;
    margin-bottom: 0;
}

.social-links {
    display: flex;
    gap: 1.25rem;
    margin-top: 2.5rem;
}

.social-links a {
    color: var(--black);
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover { opacity: 0.5; }

/* ---------- Portfolio / Galleries ---------- */

.portfolio { padding: 0 0 2rem; }

.gallery-section {
    margin: 4rem 0;
}

/* Asterisk section dividers. Render before each section heading except
   the first child. Inline-text "* * *" centered, generously spaced. */
.gallery-section + .gallery-section::before {
    content: "* * *";
    display: block;
    text-align: center;
    color: var(--gray-50);
    font-family: var(--mono);
    font-size: 0.95rem;
    letter-spacing: 0.5em;
    padding: 3.5rem 0;
}

.section-title {
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--black);
    margin: 0 0 1.75rem;
}

/* Each gallery renders as a list of rows. The build emits a CSS Grid;
   override to a vertical list. */
.project-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0;
}

.project-card {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-20);
    color: var(--black);
    min-height: 0;
}

.project-card.has-thumb img {
    width: 96px;
    height: 64px;
    object-fit: cover;
    background: var(--white);
    border: 0;
    flex: 0 0 auto;
}

.project-card:not(.has-thumb) {
    min-height: 0;
    justify-content: flex-start;
    border-top: 0;
    padding-top: 0.75rem;
}

/* Reserve the thumbnail column for thumbless cards so titles align */
.project-card:not(.has-thumb)::before {
    content: "";
    width: 96px;
    height: 64px;
    flex: 0 0 auto;
}

.project-card-content {
    padding: 0;
    text-align: left;
    flex: 1;
}

.project-card h3 {
    font-family: var(--sans);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--black);
    margin: 0;
}

.project-card h3::after {
    content: " →";
    color: var(--gray-50);
    margin-left: 0.3em;
}

.project-card:hover h3 { opacity: 0.5; }

/* ---------- Project page ---------- */

.project { padding: 3rem 0 4rem; }

.project-breadcrumb {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-50);
    margin-bottom: 2.5rem;
}

.project-breadcrumb a {
    color: var(--gray-50);
}

.project-breadcrumb a:hover { color: var(--black); opacity: 1; }

.project-header h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.05;
    margin-bottom: 2.5rem;
}

.project-body {
    max-width: 680px;
    margin: 0 0 var(--spacing-lg);
    line-height: 1.65;
    font-size: 1.08rem;
}

.project-body p { margin-bottom: 1.1em; }

.project-body a {
    color: var(--black);
    border-bottom: 1px solid var(--black);
}

.project-body a:hover { opacity: 0.5; }

.project-embed {
    margin: 3rem 0;
    max-width: 100%;
}

.project-embed iframe {
    width: 100%;
    border: 1px solid var(--black);
    border-radius: 0;
    display: block;
    background: var(--white);
}

.project-gallery {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 3rem 0;
}

.project-image { margin: 0; }

.project-image img {
    width: 100%;
    height: auto;
    border: 0;
    border-radius: 0;
    display: block;
    background: var(--white);
}

.project-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing);
    padding-top: 2rem;
    margin-top: 5rem;
    border-top: 1px solid var(--gray-20);
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-nav a { color: var(--black); }

.project-external {
    margin: 1rem 0 var(--spacing-lg);
    font-size: 1rem;
}

.project-external a {
    color: var(--black);
    border-bottom: 1px solid var(--black);
}

/* ---------- About page ---------- */

.about { padding: 3rem 0 4rem; }

.about-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    align-items: start;
}

.about-subnav a { white-space: nowrap; }

.about-subnav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: sticky;
    top: 6rem;
}

.about-subnav a {
    display: block;
    padding: 0.35rem 0;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--black);
}

.about-subnav a::after {
    content: " →";
    color: var(--gray-50);
}

.about-subnav a:hover { opacity: 0.5; }

.about-subnav a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.about-content {
    max-width: 680px;
    line-height: 1.65;
    font-size: 1.05rem;
}

.about-content h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 2rem;
}

.about-body p { margin-bottom: 1.1em; }
.about-body a {
    color: var(--black);
    border-bottom: 1px solid var(--black);
}
.about-body a:hover { opacity: 0.5; }

/* ---------- Footer ---------- */

.footer {
    background-color: var(--white);
    color: var(--black);
    padding: 3rem 0 4rem;
    margin-top: 4rem;
    border-top: 0;
    text-align: left;
    font-family: var(--sans);
    font-size: 0.8rem;
}

.footer::before {
    content: "* * *";
    display: block;
    text-align: center;
    color: var(--gray-50);
    font-family: var(--mono);
    font-size: 0.95rem;
    letter-spacing: 0.5em;
    padding-bottom: 2.5rem;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 1.75rem;
    justify-content: flex-end;
}

.footer-links a {
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    font-size: 0.85rem;
}

.footer-links a::after {
    content: " →";
    color: var(--gray-50);
    margin-left: 0.2em;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    :root {
        --spacing-xl: 4rem;
    }

    .hero { padding: 3rem 0; }

    .hero-cta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .nav-toggle { display: flex; }
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white);
        flex-direction: column;
        padding: 1rem 1.5rem;
        display: none;
        gap: 0;
        border-bottom: 1px solid var(--gray-20);
    }
    .nav-menu.active { display: flex; }
    .nav-menu li {
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--gray-20);
    }

    .about-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .about-subnav ul { position: static; }

    .project-card.has-thumb img {
        width: 64px;
        height: 48px;
    }
    .project-card:not(.has-thumb)::before {
        width: 64px;
        height: 48px;
    }
}

/* ---------- Utility bar (top-right corner: view + theme toggles) ---------- */

.utility-bar {
    position: fixed;
    top: 0.85rem;
    right: 1.5rem;
    z-index: 1001;
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    pointer-events: none;
}

.utility-bar > * { pointer-events: auto; }

.view-switch,
.theme-switch {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-50);
}

.view-switch button,
.theme-switch button {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: var(--gray-50);
}

.view-switch button.is-active,
.theme-switch button.is-active {
    color: var(--black);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.view-switch button:hover:not(.is-active),
.theme-switch button:hover:not(.is-active) {
    color: var(--black);
}

.view-switch > span,
.theme-switch > span {
    color: var(--gray-20);
}

@media (max-width: 720px) {
    .utility-bar {
        top: 0.6rem;
        right: 1rem;
        gap: 1rem;
    }
    .view-switch,
    .theme-switch {
        font-size: 0.65rem;
    }
}

/* ---------- Grid view (overrides the default list layout) ---------- */

html.view-grid .project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2.5rem 1.5rem;
}

html.view-grid .project-card {
    flex-direction: column;
    align-items: stretch;
    border-bottom: 0;
    padding: 0;
    gap: 0.6rem;
    min-height: 0;
}

html.view-grid .project-card:not(.has-thumb) {
    border-top: 0;
    padding-top: 0;
}

html.view-grid .project-card:not(.has-thumb)::before {
    display: none;
}

html.view-grid .project-card.has-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

html.view-grid .project-card-content {
    padding: 0;
}

html.view-grid .project-card h3 {
    font-size: 1rem;
}

@media (max-width: 720px) {
    html.view-grid .project-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.75rem 1rem;
    }
    html.view-grid .project-card.has-thumb img { height: 140px; }
}

/* ---------- Dark theme ---------- */

html.theme-dark {
    --white: #0d0d0d;
    --black: #f0f0f0;
    --gray-90: #d4d4d4;
    --gray-50: #8b8b8b;
    --gray-20: #2a2a2a;
}

html.theme-dark body { color-scheme: dark; }

/* Slightly soften photo brightness in dark mode so they don't blast. */
html.theme-dark .project-card.has-thumb img,
html.theme-dark .project-image img {
    filter: brightness(0.92);
}

html.theme-dark .project-embed iframe {
    background: var(--gray-20);
}
