/* ==================
   CORE DESIGN SYSTEM
   ================== */

@import url('https://fonts.googleapis.com/css2?family=Chiron+Hei+HK:ital,wght@0,200..900;1,200..900&family=East+Sea+Dokdo&display=swap');

:root {
  --ink: #2b0845;
  --ink-light: #4a0080;
  --ink-contrast: #1b4841;
  --paper: #dcdcdc;
  --paper-warm: #dfdcda;
  --paper-deep: #d8dddf;
  --accent: #5b6afb;
  --accent-soft: #7f89e6;
  --accent-contrast: #357e72;
  --accent-c-soft: #9acbc3;
  --rule: #1b4841;
  --white: #eeeff2;

  --headline: 'East Sea Dokdo', san-serif;
  --body: 'Chiron Hei HK', san-serif;
  --mono: 'DM Mono', monospace;

  --header-h: 64px;
  --sidebar-w: 280px;
  --max-content: 720px;
  --gap: 2rem;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--body);
    background: var(--paper);
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.7;
    min-height: 100vh;
}

a {
    color: var(--accent-contrast);
    text-decoration: none;
    font-weight: 550;
}

a:hover { color: var(--white); text-decoration: none; }

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

/* =========================================
   HEADER
   ========================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--header-h);
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    gap: 3rem;
    transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

.site-header.transparent {
    background: rgba(72, 61, 138, 0.2);
    border-bottom-color: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.site-header .logo,
.site-header.transparent .logo,
.site-header.transparent nav a {
    color: var(--ink-light);
    text-decoration: none;
}

.site-header .logo:hover,
.site-header.transparent .logo:hover,
.site-header.transparent nav a:hover {
  color: var(--white);
}

.logo {
    font-family: var(--headline);
    font-weight: 900;
    font-size: 1.95rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-right: auto;
    transition: color 0.4s;
}

.logo.transparent span { color: var(--white); }

.logo span { color: var(--accent); }

.logo span:hover { color: var(--ink-light); }

nav { display: flex; align-items: center; gap: 0.25rem; }

nav a {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    padding: 0.4rem 0.75rem;
    border-radius: 2px;
    transition: color 0.2s, background 0.2s;
}

nav a:hover { color: var(--accent); text-decoration: none; }
nav a.active { color: var(--accent); }

/* Dropdown */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 0.15em;
}

.nav-dropdown > a::after {
    content: '';
    font-size: 0.65rem;
    opacity: 0.2;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    min-width: 200px;
    background: var(--white);
    border: 1.5px solid var(--rule);
    border-radius: 3px;
    box-shadow: 0 8px 32px rgba(26, 20, 16, 0.1);
    padding: 0.1rem 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity 0.2s, transform 0.2s;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1.25rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.dropdown-menu a:hover { background: var(--paper-warm); color: var(--accent); }

.site-header.transparent .dropdown-menu {
    background: rgba(43, 8, 69, 0.88);
    border-color: rgba(238, 239, 242, 0.15);
}

.site-header.transparent .dropdown-menu a { color: var(--white); }
.site-header.transparent .dropdown-menu a:hover { background: rgba(238, 239, 242, 0.1); color: var(--white); }

/* =========================================
   FOOTER
   ========================================= */

.site-footer {
    background: var(--paper);
    color: var(--paper-deep);
    padding: 3rem 2.5rem 2rem;
    margin-top: auto;
    border-top: 1px solid var(--rule);
    transition: background 0.4s, border-color 0.4s;
}

.site-footer.transparent {
    background: rgba(72, 61, 138, 0.2);
    border-top-color: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.footer-inner {
    max-width: calc(var(--sidebar-w) + var(--gap) + var(--max-content));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.footer-col p, .footer-col a {
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--ink-light);
    line-height: 1.8;
    display: block;
}

.footer-col.transparent p, .footer-col.transparent a { color: var(--ink); }

.footer-col a:hover { color: var(--accent); text-decoration: none; }

.footer-col.transparent a:hover { color: var(--white); text-decoration: none; }

.footer-col:last-child {
    justify-self: end;
    text-align: right;
}

.footer-bottom {
    max-width: calc(var(--sidebar-w) + var(--gap) + var(--max-content));
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--white);
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--ink-contrast);
    letter-spacing: 0.06em;
    display: flex;
    justify-content: space-between;
    text-align: center;
}

/* =========================================
   DEFAULT PAGE LAYOUT — Two column
   ========================================= */

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-main {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: var(--gap);
    max-width: calc(var(--sidebar-w) + var(--gap) + var(--max-content) + 5rem);
    margin: 0 auto;
    padding: 3rem 2.5rem;
    flex: 1;
    width: 100%;
    align-items: start;
}

.page-hero {
    width: 100%;
}

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

/* =========================================
   SIDEBAR — Base
   ========================================= */

.sidebar {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    max-height: calc(100vh - var(--header-h) - 4rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
}

/* =========================================
   SIDEBAR — Bio Profile Mode
   ========================================= */

.sidebar-bio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.bio-photo-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 1.25rem;
    margin-top: 2rem;
}

.bio-photo-wrap::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1.5px solid var(--ink-contrast);
}

.bio-photo-wrap::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px dashed var(--ink-contrast);
    opacity: 0.5;
    animation: spin 30s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bio-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--paper);
    box-shadow: 0 4px 20px rgba(26,20,16,0.18);
}

.bio-name {
    font-family: var(--headline);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--ink);
    text-align: center;
    line-height: 1;
    max-width: 180px;
}

.bio-name span { color: var(--accent); }

.bio-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    text-align: center;
    margin-top: 0.5rem;
    max-width: 180px;
}

.bio-pronouns {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rule);
    text-align: center;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    max-width: 180px;
}

.bio-creds {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    color: var(--ink-light);
    text-align: center;
    max-width: 200px;
}

.bio-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 50%;
    margin-top: 1rem;
}

.bio-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border: 1px solid var(--ink-light);
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--ink-light);
    background: var(--white);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.bio-link:hover {
    border-color: var(--accent-c-soft);
    color: var(--white);
    background: var(--accent-contrast);
    text-decoration: none;
}

.bio-link-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.bio-link:hover .bio-link-icon { opacity: 1; }

/* =========================================
   SIDEBAR — Table of Contents Mode
   ========================================= */

.sidebar-toc {
    border-left: 2px solid var(--rule);
    padding-left: 1.25rem;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.toc-list li { position: relative; }

.toc-list a {
    font-family: var(--body);
    font-size: 0.88rem;
    color: var(--ink-light);
    display: block;
    padding: 0.3rem 0;
    transition: color 0.15s;
    line-height: 1.35;
}

.toc-list a:hover { color: var(--accent); text-decoration: none; }
.toc-list a.active { color: var(--accent); font-weight: 600; }

.toc-list .toc-h1 { padding-left: 0; }
.toc-list .toc-h2 { padding-left: 1rem; font-size: 0.8rem; }
.toc-list .toc-h3 { padding-left: 1.75rem; font-size: 0.68rem; color: var(--accent-contrast); }

.toc-progress {
    position: absolute;
    left: -1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--accent);
    transition: height 0.3s;
}

.toc-list a.active + .toc-progress,
.toc-list li:has(a.active) .toc-progress {
    height: 100%;
}

/* =========================================
   SIDEBAR — blog posts filter mode
   ========================================= */

#tag-filter-list a[data-tag="all"] {
  padding-left: 0;
}

#tag-filter-list a[data-tag]:not([data-tag="all"]) {
  font-size: 0.7rem;
  color: var(--accent-contrast);
}

/* =========================================
   MAIN CONTENT
   ========================================= */

.content {
    min-width: 0;
}

.content-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
}

.content-eyebrow {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rule);
    margin-bottom: 0.5rem;
}

.content-title {
    font-family: var(--headline);
    font-size: 3.4rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}

.content-subtitle {
    font-family: var(--body);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--accent);
}

.content-subtitle ul li{
    font-style: italic;
}

.content h2 {
    font-family: var(--headline);
    font-size: 2.2rem;
    font-weight: 700;
    margin: 2.5rem 0 0.75rem;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.content h3 {
    font-family: var(--headline);
    font-style: italic;
    font-size: 1.9rem;
    font-weight: 500;
    margin: 1rem 0 0.5rem;
    color: var(--ink);
}

.content p {
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    color: var(--ink);
}

.content p span, .content ul span {
    color: var(--ink-contrast);
    font-weight: 700;
}

.content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.content ul li {
    font-family: var(--body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

.content blockquote {
    border-left: 2px solid var(--rule);
    padding: 0.75rem 1.5rem;
    margin: 2rem 0;
    background: var(--paper-warm);
    font-style: italic;
    color: var(--ink-contrast);
    font-size: 0.95rem;
}

.content blockquote cite {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-style: normal;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    text-align: right;
    margin-top: 0.75rem;
}

blockquote cite::before {
    content: '— ';
}

/* =========================================
   CONTENT — Embedded images, GIFs, videos
   ========================================= */

.content img:not(.project-card img) {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
    margin: 1.5rem 0;
}

/* Optional caption below an image */
.content figure:not(.project-card figure) {
    margin: 1.5rem 0;
}

.content figcaption {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--ink-contrast);
    margin-top: 0.5rem;
}

/* Size variants */
.content .img-small  { max-width: 280px; }
.content .img-medium { max-width: 480px; }
.content .img-full   { max-width: 100%; }

/* Alignment */
.content .img-center { margin-left: auto; margin-right: auto; }
.content .img-left   { float: left; margin: 0.5rem 1.5rem 1rem 0; }
.content .img-right  { float: right; margin: 0.5rem 0 1rem 1.5rem; }

/* Clear floats after a floated image */
.content .img-clear { clear: both; }

/* Videos */
.video-embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 2rem 0;
}

.video-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =========================================
   LIGHTBOX
   ========================================= */

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(43, 8, 69, 0.72);
    z-index: 1000;
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.open {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    height: auto;
    width: auto;
    border-radius: 3px;
    margin: 0;
}

.content img.lightbox {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.content img.lightbox:hover {
    transform: scale(1.05);
}

/* =========================================
   LANDING PAGE
   ========================================= */

.landing-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url('assets/images/2023-04-10_Wales_bright.jpg');
    background-size: cover;
    background-position: center;
}

.landing-bg::after {
    content: '';
    position: absolute;
    inset: 0;
}

.landing-footer { position: relative; z-index: 10; margin-top: auto; }

.landing-content {
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 6rem 4rem 6rem;
}

/* Cards */
.landing-cards {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
    max-width: 520px;
}

.landing-card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 2px;
    padding: 2rem 2.5rem;
    width: 90%;
    box-shadow:
	0 4px 20px rgba(0,0,0,0.25),
	inset 0 1px 0 rgba(255,255,255,0.15);
    color: var(--paper);
    transition: transform 0.3s, box-shadow 0.3s;
}

.landing-card:hover {
    box-shadow:
	0 10px 40px rgba(0,0,0,0.45),
	inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Alternating offset from center axis */
.landing-card:nth-child(odd)  { transform: translateX(5%) ; }
.landing-card:nth-child(even) { transform: translateX(-5%) ; }
.landing-card:nth-child(odd):hover  { transform: translateX(5%) translateY(-4px); }
.landing-card:nth-child(even):hover { transform: translateX(-5%) translateY(-4px); }

.card-eyebrow {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: var(--headline);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    color: var(--ink);
}

.card-title em { font-style: italic; }

.card-title a { color: var(--white); }

.card-title span { color: var(--white); }

.card-title a:hover { text-decoration: none; color: var(--rule); }

.card-body {
    font-family: var(--body);
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--ink);
    margin-bottom: 1.25rem;
}

.card-body a { color: var(--white); font-weight: 600; text-decoration: none; }

.card-body a:hover { text-decoration: none; color: var(--rule); }

.card-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.card-cta:hover { color: var(--rule); border-color: rgba(255,255,255,0.5); text-decoration: none; }
.card-cta::after { content: '→'; }

/* Hero card (first, special) */
.landing-card.hero-card {
    width: 100%;
    transform: none;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 600px;
}

.landing-card.hero-card:hover { transform: translateY(-4px); }

.hero-card .card-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.hero-card .card-eyebrow {
    font-family: var(--mono);
    font-size: 1.5rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.5rem;
}

/* =========================================
   PROJECT GRID
   ========================================= */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0 2.5rem;
}

.project-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 3px;
    aspect-ratio: 3 / 4;
    background: var(--ink);
    text-decoration: none;
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: brightness(0.92);
}

.project-card:hover img {
    transform: scale(1.04);
    filter: brightness(0.45);
}

.project-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.project-card:hover .project-card-overlay {
    opacity: 1;
    transform: translateY(0);
}

.content .project-card-title {
    font-family: var(--headline);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.4rem;
    line-height: 1;
}

.content .project-card-desc {
    font-family: var(--body);
    font-size: 0.8rem;
    color: var(--white);
    line-height: 1.5;
    margin: 0;
}

/* =========================================
   UTILITY
   ========================================= */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.hamburger {
    display: none;
}

/* Mobile Menu -- dealing with landing page */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(72, 61, 138, 0.2);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    z-index: 800;
    overflow-y: auto;
}

.mobile-menu-overlay.open {
    display: block;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.25rem;
    gap: 0.25rem;
}

.mobile-menu-nav > a {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0.6rem 0.75rem;
    width: 100%;
    text-align: center;
    border-radius: 2px;
    transition: color 0.2s;
}

.mobile-menu-nav > a:hover {
    color: var(--white);
    text-decoration: none;
}

.mobile-menu-submenu {
    display: none;
    flex-direction: column;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.5rem 0;
    margin: 0.25rem 0;
}

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

.mobile-menu-submenu a {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    text-align: center;
    padding: 0.5rem 0;
    display: block;
    width: 100%;
}

.mobile-menu-submenu a:hover {
    color: var(--white);
    text-decoration: none;
}

.mobile-menu-dropdown {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
}

.mobile-menu-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.mobile-menu-dropdown-toggle {
    background: none;
    border: none;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 1.1rem;
    width: 1.4rem;
    height: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
    flex-shrink: 0;
}

.mobile-menu-dropdown-toggle:hover {
    color: var(--white);
}

/* Responsive -- large screens */
@media (min-width: 1089px) {
    .site-header nav {
	display: flex !important;
    }
    .mobile-submenu {
	display: none !important;
    }
}

/* Responsive -- 1088px */
@media (max-width: 1088px) {
    .site-header { padding: 0 1.25rem; gap: 1rem; }
    
    .hamburger {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.4rem;
	margin-left: auto;
    }

    .hamburger span {
	display: block;
	width: 24px;
	height: 2px;
	background: var(--ink);
	border-radius: 2px;
	transition: transform 0.3s, opacity 0.3s;
    }

    .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger.open span:nth-child(2) { opacity: 0; }
    .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .site-header nav {
	display: none;
	position: absolute;
	top: var(--header-h);
	left: 0;
	right: 0;
	background: var(--paper);
	border-bottom: 1px solid var(--rule);
	flex-direction: column;
	padding: 1rem 1.25rem;
	gap: 0.25rem;
	z-index: 899;
    }

    .site-header nav .dropdown-menu {
	display: none !important;
    }

    .site-header nav.open {
	display: flex;
    }

    /* for all pages EXCEPT landing page */
    .mobile-submenu {
	display: none;
	flex-direction: column;
	width: 100%;
	padding: 0.25rem 0;
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
    }

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

    .mobile-submenu a {
	font-family: var(--mono);
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ink-light);
	text-align: center;
	padding: 0.5rem 0;
	display: block;
	width: 100%;
    }

    .mobile-submenu a:hover {
	color: var(--accent);
	text-decoration: none;
    }

    /* rules for landing page */
    .site-header.transparent .hamburger span {
	background: var(--ink);
    }
    
    .site-header.transparent nav a {
	color: var(--ink);
    }
    
    .site-header.transparent nav a:hover {
	color: var(--white);
    }
}

/* Responsive -- 768px */
@media (max-width: 768px) {

    .page-main {
	grid-template-columns: 1fr;
	padding: 2rem 1.25rem;
    }

    .sidebar { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 2rem; margin-bottom: 1rem; }

    .footer-inner { grid-template-columns: 1fr; }

    .content-title { font-size: 2rem; }

    .landing-content { padding: 5rem 3rem 4rem 3rem; }

    .landing-cards { max-width: 540px; }

    .landing-card { width: 100%; padding: 1.5rem 1.75rem; }

    .landing-card:nth-child(odd), .landing-card:nth-child(even) { transform: none; }

    .landing-card.hero-card { max-width: 100%; padding: 1.5rem 1.75rem; }

    .card-eyebrow {
	letter-spacing: 0.08em;
    }

    .project-grid {
	grid-template-columns: repeat(2, 1fr);
	gap: 0.85rem;
    }
}

/* =========================================
   BLOG — Post list (scribbles index)
   ========================================= */

.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-item + .post-item {
    border-top: 1px solid var(--paper-deep);
}

.post-card {
    padding: 1.75rem 0;
    display: grid;
    gap: 0.1rem;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.post-date {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-contrast);
}

.post-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.post-tag {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    border: 1px solid var(--accent-contrast);
    border-radius: 2px;
    padding: 0.05em 0.45em;
    opacity: 0.7;
}

.post-title {
    font-family: var(--headline);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
}

h2.post-title {
  margin: 0.15rem 0 0;
}

.post-title a {
    color: var(--ink);
    text-decoration: none;
    transition: color 0.18s;
}

.post-title a:hover { color: var(--accent); text-decoration: none; }

.post-excerpt {
    font-family: var(--body);
    font-size: 0.92rem;
    color: var(--ink);
    line-height: 1.65;
    margin: 0.35rem 0 0.1rem;
    max-width: 56ch;
}

p.post-excerpt {
    margin-bottom: 0.5rem;
}

.post-read-more {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    text-decoration: none;
    transition: color 0.18s;
    margin-top: 0.25rem;
    align-self: start;
}

.post-read-more:hover { color: var(--accent); text-decoration: none; }

/* Post meta row (inside a post page) */
.post-meta-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 1rem;
}

/* =========================================
   FOOTNOTES
   ========================================= */

.fn-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-contrast);
    background: transparent;
    border: 1px solid var(--accent-contrast);
    border-radius: 2px;
    padding: 0 0.28em;
    min-width: 1.3em;
    height: 1.3em;
    vertical-align: super;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background 0.18s, color 0.18s;
    margin: 0 0.1em;
}
 
.fn-ref:hover,
.fn-ref:focus {
    background: var(--accent-contrast);
    color: var(--white);
    text-decoration: none;
    outline: none;
}

/* ── Body-level footnote tooltip ────────────────────────────────────────
   Appended to <body> by footnotes.js, positioned with JS.
   Being outside .fn-ref means no flex / overflow / stacking-context issues. */
 
.fn-tooltip {
    position: absolute;          /* JS sets top/left */
    z-index: 9000;
    width: 280px;
    background: var(--ink);
    color: var(--white);
    font-family: var(--body);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    padding: 0.55rem 0.8rem;
    border-radius: 3px;
    border-left: 3px solid var(--accent-contrast);
    box-shadow: 0 4px 16px rgba(26, 20, 16, 0.22);
    pointer-events: none;        /* invisible until shown */
    opacity: 0;
    transition: opacity 0.18s;
    white-space: normal;
    text-align: left;
}
 
.fn-tooltip.fn-tooltip--visible {
    opacity: 1;
    pointer-events: auto;
}

/* Caret — JS sets its left position to track the ref centre */
.fn-tooltip-caret {
    position: absolute;
    bottom: -8px;                /* points downward toward the ref */
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--ink);
}
 
/* Flipped caret when tooltip appears below the ref */
.fn-tooltip--below .fn-tooltip-caret {
    bottom: auto;
    top: -8px;
    border-top-color: transparent;
    border-bottom-color: var(--ink);
}

/* Links inside the tooltip */
.fn-tooltip a {
    color: var(--accent-c-soft);
    text-decoration: underline;
    font-weight: 400;
}
 
.fn-tooltip a:hover {
    color: var(--white);
}
 
.footnotes {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}
 
.footnotes-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-contrast);
    margin-bottom: 1rem;
}
 
.footnotes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footnotes-list li {
    display: flex;
    gap: 0.6rem;
    font-family: var(--body);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--ink);
    margin-bottom: 0.65rem;
    scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
 
.fn-num {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-contrast);
    border: 1px solid var(--accent-contrast);
    border-radius: 2px;
    padding: 0 0.28em;
    height: 1.4em;
    min-width: 1.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.22em;
    transition: background 0.18s, color 0.18s;
}

/* Text content of a footnote — grows to fill the flex row, keeping
   any inline <a> tags from becoming rogue flex items */
.fn-body {
    flex: 1;
    min-width: 0;
}
 
.fn-back {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--accent-contrast);
    text-decoration: none;
    margin-left: 0.35em;
    opacity: 0.6;
    transition: opacity 0.15s;
}
 
.fn-back:hover { opacity: 1; color: var(--accent-contrast); text-decoration: none; }
 
.footnotes-list li.fn-highlight .fn-num {
    background: var(--accent-contrast);
    color: var(--white);
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 480px) {
    .project-grid {
	grid-template-columns: 1fr;
	gap: 0.75rem;
    }
    
    .project-card {
	aspect-ratio: 4 / 3;
    }
 
    /* On touch devices, show the overlay permanently since there's no hover */
    .project-card-overlay {
	opacity: 1;
	transform: translateY(0);
	background: linear-gradient(to top, rgba(43, 8, 69, 0.85) 0%, transparent 60%);
    }
 
    .project-card img {
	filter: brightness(0.75);
    }
}
