/*
Theme Name: Nox Studios
Author: Nick Gerald Tabat
Description: A monochrome portfolio with sidebar navigation, compact project cards, and ACF-managed content.
Version: 4.0.0
Requires at least: 6.2
Requires PHP: 7.4
Text Domain: nox-portfolio
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

@font-face {
    font-family: Inter;
    src: url("assets/fonts/inter.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("assets/fonts/ibm-plex-mono.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg: #101010;
    --ink: #ededed;
    --muted: #aaa;
    --subtle: #929292;
    --surface: #171717;
    --surface-hover: #202020;
    --line: #2b2b2b;
    --strong-line: #424242;
    --shadow: none;
    --logo-filter: brightness(0) invert(1);
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #fff;
    --ink: #151515;
    --muted: #616161;
    --subtle: #737373;
    --surface: #fafafa;
    --surface-hover: #f2f2f2;
    --line: #e6e6e6;
    --strong-line: #c4c4c4;
    --shadow: 0 9px 24px -20px #0005;
    --logo-filter: brightness(0);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body { margin: 0; font: 14px/1.75 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.theme-ready { transition: background-color .2s, color .2s; }
::selection { color: var(--bg); background: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
img { display: block; max-width: 100%; }
svg { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { font-weight: 550; line-height: 1.35; letter-spacing: -.035em; }
[hidden] { display: none !important; }
.mono, kbd { font-family: var(--mono); font-weight: 400; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; top: 10px; left: 10px; z-index: 200; padding: 10px 18px; background: var(--ink); color: var(--bg); }
.brand-logo { object-fit: contain; filter: var(--logo-filter); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 7px; flex-shrink: 0; }
.icon-button:hover { background: var(--surface-hover); }
.text-link { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; padding: 0; font: 11px/1.6 var(--mono); }
.text-link svg { width: 13px; height: 13px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.file-note { color: var(--subtle); font: 9px var(--mono); margin-left: -3px; }
kbd { font-size: 8px; color: var(--subtle); white-space: nowrap; border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; line-height: 1.5; }

/* Content controls and optional project details */
.social-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; }
.social-links a { min-height: 32px; overflow-wrap: anywhere; }
.project-search { margin-top: 24px; }
.project-search label { display: block; margin-bottom: 7px; font: 11px/1.6 var(--mono); color: var(--muted); }
.project-search > div { display: flex; gap: 10px; }
.project-search input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); font-size: 16px; }
.project-search .filter-button { flex-shrink: 0; min-height: 44px; }
.filter-status { color: var(--subtle); font-size: 11px; margin-top: 12px; }
.filter-status:empty { display: none; }
.project-empty { padding: 24px 0; color: var(--muted); }
.project-cover { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 7px; margin-bottom: 16px; background: var(--bg); }
.project-case-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font: 11px/1.6 var(--mono); }
.project-case-link svg { width: 14px; height: 14px; }
.case-study.content-page { width: 100%; max-width: 1000px; margin: 0 auto; padding: 50px 40px 70px; overflow-wrap: anywhere; }
.case-study > article > .text-link > svg { transform: rotate(180deg); }
.case-header { margin: 35px 0; }
.case-study .case-header h1 { margin: 14px 0 24px; font-size: clamp(30px, 5vw, 54px); }
.case-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 0 0 20px; }
.case-facts dt { font-size: 10px; color: var(--subtle); }
.case-facts dd { margin: 6px 0 0; }
.case-cover, .case-gallery img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.case-copy, .case-gallery { margin-top: 40px; }
.case-copy h2, .case-gallery h2 { font-size: 23px; margin-bottom: 16px; }
.case-copy p { color: var(--muted); max-width: 75ch; margin: 0 0 16px; }
.case-gallery figure { margin: 24px 0 0; }
.case-gallery figcaption { color: var(--muted); margin-top: 10px; font-size: 12px; }
.case-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; margin-top: 45px; padding-top: 25px; border-top: 1px solid var(--line); }
.case-pagination a { display: grid; min-height: 44px; gap: 5px; max-width: 100%; }
.case-pagination span { font-size: 10px; color: var(--subtle); }
@media (max-width: 600px) {
    .project-search > div { flex-wrap: wrap; }
    .project-search input { flex-basis: 100%; }
    .case-study.content-page { padding: 28px 20px 45px; }
    .case-facts { grid-template-columns: 1fr; gap: 16px; }
    .case-header { margin-top: 25px; }
}

/* Persistent navigation */
.site-header { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 224px; height: 100dvh; border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; }
.sidebar-top { min-height: 108px; display: flex; align-items: center; justify-content: space-between; padding: 26px 23px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; letter-spacing: -.055em; white-space: nowrap; }
.brand .brand-logo { width: 30px; height: 30px; }
.menu-toggle { display: none; }
.sidebar-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 20px 18px 24px; scrollbar-width: thin; }
.sidebar-label { font-size: 9px; color: var(--subtle); letter-spacing: .12em; padding: 0 12px 13px; }
.primary-nav { display: grid; gap: 3px; }
.primary-nav > a { display: grid; grid-template-columns: 16px 1fr 12px; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 8px; font: 11px/1.6 var(--mono); color: var(--muted); }
.primary-nav > a > svg { width: 15px; height: 15px; }
.primary-nav > a:hover { background: var(--surface); color: var(--ink); }
.primary-nav > a.is-current { color: var(--ink); background: var(--surface-hover); }
.nav-indicator { opacity: 0; font-size: 11px; }
.is-current .nav-indicator { opacity: 1; }
.sidebar-tools { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 18px; }
.sidebar-tools > button, .sidebar-tools > a { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 43px; padding: 9px 12px; font: 10px/1.7 var(--mono); text-align: left; color: var(--muted); border-radius: 8px; }
.sidebar-tools > button:hover, .sidebar-tools > a:hover { color: var(--ink); background: var(--surface); }
.sidebar-tools svg { width: 15px; height: 15px; }
.sidebar-tools kbd, .sidebar-playground > svg:last-child { margin-left: auto; }
.sidebar-playground > svg:last-child { width: 12px; height: 12px; }
.sidebar-bottom { margin-top: auto; padding: 44px 11px 0; }
.appearance-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.appearance-control > span { font-size: 8px; letter-spacing: .05em; color: var(--subtle); }
.appearance-control > div { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.appearance-control button { display: flex; align-items: center; justify-content: center; width: 26px; height: 27px; padding: 0; color: var(--muted); border-radius: 5px; }
.appearance-control svg { width: 13px; height: 13px; }
.appearance-control button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.sidebar-bottom > p { font-size: 10px; color: var(--muted); }
.sidebar-bottom > a { display: block; font: 9px/1.9 var(--mono); overflow-wrap: anywhere; color: var(--subtle); margin-top: 6px; }
.sidebar-bottom > a:hover { color: var(--ink); }
.admin-bar .site-header { top: 32px; height: calc(100dvh - 32px); }

/* Reading column and compact profile */
.page-shell { margin-left: 224px; }
.portfolio-layout { max-width: 1120px; margin-inline: auto; padding: 62px 48px 0; display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 42px; }
.portfolio-main { min-width: 0; }
.profile-section { position: relative; }
.profile-section::before { content: ""; position: absolute; top: -15px; right: 0; width: 230px; height: 150px; opacity: .16; background-image: radial-gradient(var(--ink) .8px, transparent .8px); background-size: 7px 7px; mask-image: radial-gradient(ellipse at 70% 20%, #000, transparent 70%); pointer-events: none; }
.profile-heading { display: flex; align-items: center; gap: 17px; position: relative; }
.profile-heading > div:last-child { min-width: 0; }
.profile-avatar { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.profile-avatar img { width: 50px; height: 50px; }
.profile-location { font-size: 9px; color: var(--subtle); letter-spacing: .025em; margin-bottom: 7px; text-transform: uppercase; }
.profile-heading h1 { font: 400 33px/1.15 var(--mono); letter-spacing: -.075em; }
.profile-owner { font-size: 12px; color: var(--muted); margin-top: 6px; }
.profile-greeting { font-size: 12px; color: var(--muted); margin-top: 27px; }
.profile-tagline { font-size: 24px; font-weight: 500; letter-spacing: -.045em; margin-top: 11px; max-width: 570px; }
.profile-tagline > span { color: var(--muted); }
.profile-intro { font-size: 14px; line-height: 1.85; color: var(--muted); max-width: 550px; margin-top: 13px; }
.profile-role { display: inline-block; font: 10px/1.6 var(--mono); padding: 5px 9px; margin-top: 20px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.profile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 13px; }
.profile-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); margin-top: 24px; }
.profile-facts > div { padding: 18px 14px; }
.profile-facts > div:first-child { padding-left: 0; }
.profile-facts > div + div { border-left: 1px solid var(--line); }
.profile-facts strong { display: block; font: 400 24px/1.3 var(--mono); letter-spacing: -.075em; }
.profile-facts span { display: block; margin-top: 7px; font: 9px/1.65 var(--mono); color: var(--subtle); }
.portfolio-section { margin-top: 52px; padding-top: 40px; border-top: 1px solid var(--line); }
.profile-section + .portfolio-section { border-top: 0; padding-top: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.section-kicker, .section-count { font-size: 9px; letter-spacing: .055em; color: var(--subtle); }
.section-count { text-align: right; }
.portfolio-section > h2 { font-size: 22px; font-weight: 550; letter-spacing: -.045em; line-height: 1.4; }
.section-intro { font-size: 14px; line-height: 1.8; color: var(--muted); margin-top: 10px; }
.section-action { display: inline-flex; align-items: center; gap: 7px; font: 10px/1.5 var(--mono); }
.section-action svg { width: 11px; height: 11px; }

/* Work */
.work-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 17px; }
.filter-button { display: inline-flex; gap: 6px; align-items: center; min-height: 30px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; font: 9px/1.5 var(--mono); color: var(--muted); }
.filter-button span { opacity: .7; }
.filter-button:hover { border-color: var(--strong-line); color: var(--ink); }
.filter-button.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.project-card { min-width: 0; min-height: 177px; display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s ease, background-color .2s; }
.project-card:hover { transform: translateY(-3px); border-color: var(--strong-line); background: var(--surface-hover); }
.project-card-top { display: flex; align-items: center; gap: 8px; }
.project-symbol { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--strong-line); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink); flex-shrink: 0; }
.project-platform { margin-left: auto; color: var(--subtle); font-size: 9px; text-align: right; }
.project-card-top > svg { width: 12px; height: 12px; color: var(--subtle); }
.project-card h3 { font-size: 15px; font-weight: 550; letter-spacing: -.025em; margin-top: 15px; line-height: 1.4; }
.project-card > p { font: 10px/1.8 var(--mono); color: var(--subtle); margin-top: 4px; overflow-wrap: anywhere; }
.project-stack { display: block; font-size: 11px; line-height: 1.6; padding-top: 13px; margin-top: auto; color: var(--muted); }
.work-note { font-size: 11px; line-height: 1.8; color: var(--subtle); margin-top: 18px; }

/* Work history */
.experience-list { margin-top: 23px; }
.experience-item { position: relative; }
.experience-item:not(:last-child)::before { content: ""; position: absolute; left: 3px; top: 29px; bottom: -8px; width: 1px; background: var(--line); }
.experience-item summary { display: grid; grid-template-columns: 8px minmax(0, 1fr) 13px; gap: 14px; align-items: start; list-style: none; cursor: pointer; padding: 18px 0; }
.experience-item:first-child summary { padding-top: 3px; }
.experience-item summary::-webkit-details-marker { display: none; }
.timeline-dot { width: 7px; height: 7px; background: var(--strong-line); border-radius: 50%; margin-top: 7px; position: relative; z-index: 1; }
.experience-item[open] .timeline-dot { background: var(--ink); }
.experience-heading h3 { font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: -.02em; }
.experience-heading p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.experience-date { display: block; color: var(--subtle); font-size: 10px; margin-top: 5px; }
.expand-icon { width: 13px; height: 13px; position: relative; margin-top: 5px; }
.expand-icon::before, .expand-icon::after { content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 1px; background: var(--muted); }
.expand-icon::after { transform: rotate(90deg); }
.experience-item[open] .expand-icon::after { transform: rotate(0); }
.experience-detail { padding: 0 22px 24px; margin-left: 0; font-size: 13px; line-height: 1.9; color: var(--muted); }
.experience-detail .experience-arrangement { font-size: 9px; color: var(--subtle); padding-bottom: 12px; text-transform: uppercase; }
.experience-detail > p + p { margin-top: 10px; }
.service-list { display: grid; gap: 12px; margin-top: 23px; }
.service-card { padding: 19px; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; }
.service-heading { display: flex; align-items: center; gap: 11px; }
.service-heading h3 { font-size: 14px; font-weight: 500; }
.service-icon { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); }
.service-icon svg { width: 14px; height: 14px; }
.service-card > p { font-size: 13px; line-height: 1.85; color: var(--muted); margin-top: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin-top: 16px; }
.tag-list > li { font: 9px/1.6 var(--mono); color: var(--muted); padding: 3px 7px; border: 1px solid var(--strong-line); border-radius: 20px; }
.about-copy { font-size: 14px; line-height: 1.95; color: var(--muted); margin-top: 18px; }
.about-copy > p + p { margin-top: 17px; }
.education { display: flex; align-items: flex-start; gap: 13px; padding: 18px; margin-top: 23px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.education-icon > svg { width: 18px; height: 18px; margin-top: 2px; }
.education .mono { font-size: 7px; color: var(--subtle); margin-bottom: 6px; }
.education h3 { font-size: 13px; font-weight: 500; margin-bottom: 7px; }
.education h3 + p { font-size: 11px; line-height: 1.8; color: var(--muted); }
.contact-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); margin-top: 22px; }
.contact-email { font-size: 14px; font-weight: 450; overflow-wrap: anywhere; min-width: 0; }
.contact-email:hover { text-decoration: underline; text-underline-offset: 4px; }
.copy-email { font: 8px/1.7 var(--mono); color: var(--muted); }
.contact-box .copy-email svg { width: 15px; height: 15px; }
.mail-link { margin-top: 9px; color: var(--muted); }

/* Context column */
.context-rail { align-self: start; position: sticky; top: 45px; }
.rail-location { display: flex; flex-direction: column; gap: 6px; padding: 0 2px 18px; }
.rail-location > span { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .04em; }
.rail-location > time { font-size: 10px; }
.rail-card { border: 1px solid var(--line); border-radius: 15px; padding: 19px; margin-bottom: 17px; background: var(--surface); overflow: hidden; }
.rail-label { font-size: 9px; color: var(--subtle); letter-spacing: .06em; }
.rail-card h2 { font: 400 20px/1.3 var(--mono); letter-spacing: -.06em; margin-top: 11px; }
.rail-email { display: flex; align-items: start; gap: 8px; font-size: 11px; overflow-wrap: anywhere; margin-top: 18px; }
.rail-email svg { width: 13px; height: 13px; margin-top: 3px; }
.rail-card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; padding-top: 15px; margin-top: 18px; border-top: 1px solid var(--line); font: 8px/1.7 var(--mono); }
.rail-card-footer a { display: flex; align-items: center; gap: 7px; }
.rail-card-footer svg { width: 11px; height: 11px; }
.rail-playground-art { height: 90px; position: relative; margin: -19px -19px 20px; background-image: radial-gradient(var(--strong-line) .8px, transparent .8px); background-size: 6px 6px; overflow: hidden; }
.rail-playground-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--surface), transparent 100%); }
.rail-playground-art > span { position: absolute; border-radius: 5px; transform: rotate(-8deg); }
.rail-playground-art > span:nth-child(1) { width: 55px; height: 55px; top: 20px; left: 52px; background: var(--ink); opacity: .8; }
.rail-playground-art > span:nth-child(2) { width: 45px; height: 25px; top: 16px; left: 116px; background: var(--strong-line); }
.rail-playground-art > span:nth-child(3) { width: 45px; height: 25px; top: 49px; left: 121px; background: var(--muted); opacity: .5; }
.playground-rail-card > p:not(.mono) { font-size: 11px; color: var(--muted); margin-top: 10px; }
.playground-rail-card .text-link { margin-top: 14px; font-size: 9px; }
.rail-quick-find { display: grid; grid-template-columns: 13px 1fr auto; gap: 10px; align-items: center; width: 100%; border: 1px dashed var(--strong-line); padding: 13px; border-radius: 10px; color: var(--muted); font-size: 9px; text-align: left; }
.rail-quick-find > svg { width: 13px; height: 13px; }
.rail-quick-find kbd { font-size: 7px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1120px; margin-inline: auto; padding: 55px 48px 30px; font: 8px/1.7 var(--mono); color: var(--subtle); }
.footer-inner a:hover { color: var(--ink); }

/* Native dialogs keep focus contained and provide Escape dismissal. */
dialog { color: var(--ink); background: var(--bg); border: 1px solid var(--strong-line); border-radius: 17px; padding: 0; max-height: 88dvh; width: calc(100% - 32px); margin: auto; box-shadow: 0 30px 100px -30px #0009; }
dialog::backdrop { background: #0008; backdrop-filter: blur(7px); }
.quick-find-dialog { max-width: 490px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; }
.dialog-heading h2 { font-size: 16px; font-weight: 500; }
.dialog-heading .rail-label { margin-bottom: 6px; }
.dialog-heading > .icon-button { margin: -5px -4px -5px 0; }
.quick-search { display: flex; align-items: center; gap: 11px; margin: 0 20px; padding: 11px 12px; border: 1px solid var(--strong-line); border-radius: 8px; background: var(--surface); }
.quick-search > svg { color: var(--muted); width: 16px; height: 16px; }
.quick-search > input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.quick-search:focus-within { outline: 1px solid var(--ink); }
.quick-results { display: grid; padding: 10px; max-height: 360px; overflow-y: auto; }
.quick-results > a { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; min-height: 44px; border-radius: 7px; font-size: 12px; }
.quick-results > a:hover, .quick-results > a:focus-visible { background: var(--surface-hover); }
.quick-results > a > svg { width: 13px; height: 13px; color: var(--muted); }
.quick-empty { font-size: 12px; color: var(--muted); padding: 20px; }
.dialog-hint { display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding: 12px 20px; font-size: 7px; color: var(--subtle); }
/* A service demo in a modal; its body scrolls independently on small screens. */
.has-open-dialog { overflow: hidden; }
.service-lab-dialog { max-width: 820px; max-height: calc(100dvh - 32px); overflow: hidden; }
.service-lab-dialog[open] { display: flex; flex-direction: column; }
.service-lab-dialog > :not(.lab-body) { flex-shrink: 0; }
.lab-heading { padding-bottom: 10px; align-items: start; }
.lab-heading h2 { font-size: 23px; }
.lab-intro { font-size: 14px; color: var(--muted); padding: 0 20px 17px; }
.lab-tabs { display: flex; border-block: 1px solid var(--line); padding: 0 14px; }
.lab-tabs > button { flex: 1; min-height: 50px; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 12px; }
.lab-tabs > button[aria-selected="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.lab-body { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 24px; padding: 24px 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.lab-body > *, .lab-panels > section { min-width: 0; }
.lab-step { color: var(--subtle); font-size: 9px; letter-spacing: .04em; margin-bottom: 10px; }
.lab-panels h3 { font-size: 21px; }
.lab-copy { color: var(--muted); font-size: 14px; margin-top: 10px; line-height: 1.75; }
.lab-label { display: block; color: var(--muted); font-size: 12px; margin-top: 18px; margin-bottom: 8px; }
#lab-headline { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--strong-line); border-radius: 7px; background: var(--surface); font-size: 16px; }
.lab-control > div { display: flex; gap: 8px; }
.lab-control button { flex: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; color: var(--muted); }
.lab-control button[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.lab-button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 11px 13px; margin-top: 12px; border: 1px solid var(--strong-line); border-radius: 7px; font-size: 13px; text-align: left; }
.lab-button svg { width: 15px; height: 15px; }
.lab-primary { color: var(--bg); background: var(--ink); border-color: var(--ink); margin-top: 20px; }
.lab-button:disabled { opacity: .4; }
.lab-checks { list-style: none; padding: 0; margin-top: 15px; }
.lab-checks li { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.lab-checks .mono { flex-shrink: 0; font-size: 11px; }
.lab-checks [data-result="fail"] .mono { padding: 1px 6px; background: var(--ink); color: var(--bg); border-radius: 4px; }
.lab-checks [data-result="pass"] .mono { color: var(--ink); }
.lab-backup { border: 1px dashed var(--strong-line); padding: 16px; margin-top: 20px; border-radius: 9px; }
.lab-backup > span { color: var(--subtle); font-size: 10px; }
.lab-backup > p { font-size: 13px; margin-top: 8px; color: var(--muted); }
.lab-preview-label { display: flex; justify-content: space-between; gap: 12px; font-size: 9px; color: var(--subtle); margin-bottom: 12px; }
.lab-preview-frame { container: sample / inline-size; width: 100%; margin-inline: auto; background: var(--surface); border: 1px solid var(--strong-line); border-radius: 9px; overflow: hidden; }
.lab-preview-frame[data-device="phone"] { max-width: 230px; }
.lab-mini-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); margin-inline: 20px; padding-block: 16px; font-size: 12px; font-weight: 550; }
.lab-mini-content { display: grid; grid-template-columns: minmax(0, 1fr) .4fr; align-items: center; gap: 15px; padding: 28px 20px; min-height: 260px; }
.lab-mini-copy { min-width: 0; }
.lab-mini-copy > .mono { font-size: 8px; color: var(--subtle); margin-bottom: 12px; }
.lab-mini-copy h3 { font-size: 27px; line-height: 1.15; overflow-wrap: anywhere; min-height: 1.15em; }
.lab-mini-copy h3 + p { font-size: 12px; line-height: 1.8; margin-top: 14px; color: var(--muted); }
.lab-mini-copy > button { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--ink); margin-top: 15px; font-size: 12px; }
.lab-mini-copy > button svg { width: 12px; height: 12px; }
.lab-mini-art { display: grid; grid-template-rows: 2fr 1fr 1fr; gap: 6px; height: 150px; }
.lab-mini-art > span { background: var(--ink); opacity: .85; border-radius: 4px; }
.lab-mini-art > span:nth-child(2) { opacity: .3; }
.lab-mini-art > span:nth-child(3) { opacity: .15; }
.lab-mini-footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 13px 20px; color: var(--subtle); font-size: 8px; }
.lab-preview-frame[data-layout="centered"] .lab-mini-content { grid-template-columns: minmax(0, 1fr); text-align: center; }
.lab-preview-frame[data-layout="centered"] .lab-mini-art { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr; height: 40px; }
.lab-preview-note { color: var(--subtle); font-size: 11px; text-align: center; margin-top: 12px; }
.lab-status { font-size: 12px; color: var(--muted); padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); max-height: 90px; overflow-y: auto; }
.lab-footer { display: flex; justify-content: space-between; gap: 8px 20px; padding: 8px 20px; border-top: 1px solid var(--line); }
.lab-footer .text-link { min-height: 44px; }
@container sample (max-width: 290px) {
    .lab-mini-content { grid-template-columns: minmax(0, 1fr); min-height: 210px; padding-block: 23px; }
    .lab-mini-art { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr; height: 35px; }
    .lab-mini-copy h3 { font-size: 24px; }
}
.container { max-width: 960px; margin-inline: auto; padding-inline: 40px; }
.content-page { padding-block: 70px; min-height: 70vh; }
.content-page h1 { font-size: 36px; margin-bottom: 22px; }
.content-page article + article { margin-top: 45px; }
.entry-content { margin-top: 20px; }
.entry-content p { margin-block: 1em; }
.entry-content a { text-decoration: underline; }
.content-page .button { display: inline-flex; align-items: center; gap: 12px; padding: 12px 0; }

@media (max-width: 1279px) {
    .portfolio-layout { display: block; max-width: 820px; padding-inline: 42px; }
    .context-rail { display: none; }
    .footer-inner { max-width: 820px; padding-inline: 42px; }
}

@media (max-width: 1023px) {
    html { scroll-padding-top: 92px; }
    .site-header { position: sticky; top: 0; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar-top { min-height: 66px; height: 66px; padding: 14px 24px; }
    .brand { font-size: 16px; }
    .brand .brand-logo { width: 28px; height: 28px; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 10px; margin-right: -8px; min-width: 44px; min-height: 44px; }
    .menu-lines { display: block; width: 19px; height: 12px; position: relative; }
    .menu-lines::before, .menu-lines::after { content: ""; position: absolute; left: 0; width: 19px; height: 1px; background: currentColor; transition: transform .2s; }
    .menu-lines::before { top: 3px; }
    .menu-lines::after { top: 10px; }
    .menu-toggle[aria-expanded="true"] .menu-lines::before { top: 6px; transform: rotate(45deg); }
    .menu-toggle[aria-expanded="true"] .menu-lines::after { top: 6px; transform: rotate(-45deg); }
    .sidebar-content { overflow: visible; padding: 22px 24px; }
    .js .sidebar-content { display: none; position: fixed; inset: 66px 0 0; overflow-y: auto; overscroll-behavior-y: contain; background: var(--bg); padding: 22px 24px max(24px, env(safe-area-inset-bottom)); }
    .js .sidebar-content.is-open { display: flex; }
    html:not(.js) .site-header { position: static; }
    .primary-nav > a { min-height: 48px; font-size: 13px; }
    .sidebar-tools > button, .sidebar-tools > a { min-height: 47px; font-size: 11px; }
    .sidebar-tools kbd { font-size: 9px; }
    .sidebar-bottom { padding-top: 30px; }
    .sidebar-bottom > a { font-size: 10px; }
    .sidebar-bottom > p { font-size: 11px; }
    .appearance-control { max-width: 280px; }
    .appearance-control > span { font-size: 9px; }
    .appearance-control button { width: 44px; height: 44px; }
    .has-open-menu { overflow: hidden; }
    .page-shell { margin-left: 0; }
    .portfolio-layout { padding: 40px max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); }
    .footer-inner { padding: 45px 32px 26px; }
    .admin-bar .site-header { top: 32px; height: auto; }
    .js .admin-bar .sidebar-content { top: 98px; }
}

@media (max-width: 600px) {
    body { font-size: 16px; line-height: 1.75; -webkit-text-size-adjust: 100%; }
    .portfolio-layout { padding: 28px max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
    .sidebar-top { padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
    .profile-section::before { width: 160px; height: 110px; }
    .profile-heading { gap: 12px; }
    .profile-avatar { width: 52px; height: 52px; border-radius: 12px; }
    .profile-avatar > img { width: 38px; height: 38px; }
    .profile-heading h1 { font-size: clamp(24px, 7vw, 30px); }
    .profile-owner { font-size: 13px; }
    .profile-location { font-size: 10px; line-height: 1.65; margin-bottom: 5px; }
    .profile-greeting { margin-top: 24px; font-size: 14px; }
    .profile-tagline { font-size: 28px; line-height: 1.3; margin-top: 12px; }
    .profile-intro { font-size: 16px; line-height: 1.8; margin-top: 16px; }
    .profile-role { font-size: 11px; padding: 7px 10px; }
    .profile-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
    .profile-actions .text-link { min-height: 48px; justify-content: center; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
    .profile-actions [data-open-dialog="playground-dialog"] { grid-column: 1 / -1; }
    .profile-facts { grid-template-columns: 1fr; margin-top: 24px; }
    .profile-facts > div { display: grid; grid-template-columns: 95px minmax(0, 1fr); align-items: center; gap: 12px; padding: 15px 0; }
    .profile-facts > div + div { border-left: 0; border-top: 1px solid var(--line); }
    .profile-facts strong { font-size: 22px; }
    .profile-facts span { font-size: 12px; line-height: 1.65; margin-top: 0; }
    .portfolio-section { margin-top: 44px; padding-top: 32px; }
    .portfolio-section > h2 { font-size: 25px; line-height: 1.35; }
    .section-heading { flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
    .section-kicker, .section-count { font-size: 10px; }
    .section-intro { font-size: 16px; line-height: 1.8; margin-top: 14px; }
    .section-action { min-height: 44px; font-size: 12px; }
    .work-filters { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding: 0 0 8px; gap: 8px; scrollbar-width: thin; }
    .filter-button { flex-shrink: 0; min-height: 44px; padding: 10px 14px; font-size: 12px; }
    .project-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 15px; }
    .project-card { padding: 20px; min-height: 185px; border-radius: 12px; }
    .project-symbol { width: 36px; height: 36px; font-size: 12px; }
    .project-platform { font-size: 11px; }
    .project-card h3 { font-size: 19px; margin-top: 17px; }
    .project-card > p { font-size: 12px; line-height: 1.8; }
    .project-stack { font-size: 13px; padding-top: 18px; }
    .project-card:hover { transform: none; }
    .work-note { font-size: 13px; }
    .experience-item summary { gap: 12px; padding-block: 22px; }
    .experience-heading h3 { font-size: 17px; }
    .experience-heading p { font-size: 14px; }
    .experience-date { font-size: 12px; }
    .experience-detail { font-size: 15px; line-height: 1.85; padding: 0 0 24px 20px; }
    .experience-detail .experience-arrangement { font-size: 11px; }
    .service-card { padding: 20px; }
    .service-heading h3 { font-size: 17px; }
    .service-icon { flex-shrink: 0; }
    .service-card > p { font-size: 15px; line-height: 1.85; }
    .tag-list { gap: 8px; }
    .tag-list > li { font-size: 11px; padding: 5px 9px; }
    .about-copy { font-size: 16px; line-height: 1.85; }
    .education { padding: 18px 16px; }
    .education > div { min-width: 0; }
    .education .mono { font-size: 10px; }
    .education h3 { font-size: 16px; }
    .education h3 + p { font-size: 14px; }
    .contact-box { gap: 8px; padding: 12px; }
    .contact-email { font-size: 14px; }
    .mail-link { font-size: 13px; min-height: 44px; }
    .footer-inner { padding: 36px 20px max(26px, env(safe-area-inset-bottom)); font-size: 10px; flex-wrap: wrap; }
    .footer-inner a { display: flex; align-items: center; min-height: 44px; }
    .service-lab-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
    .service-lab-dialog .lab-heading h2 { font-size: 21px; }
    .lab-intro { padding-inline: 16px; font-size: 14px; }
    .lab-tabs { padding-inline: 8px; }
    .lab-tabs button { font-size: 12px; }
    .lab-body { grid-template-columns: minmax(0, 1fr); padding: 20px 16px; gap: 24px; }
    .lab-copy { font-size: 15px; }
    .lab-preview-area { padding-top: 20px; border-top: 1px solid var(--line); }
    .lab-footer { padding-inline: 16px; flex-wrap: wrap; gap: 0 16px; }
    .lab-footer .text-link { font-size: 11px; }
    .lab-status { padding-inline: 16px; font-size: 12px; max-height: 100px; }
    .dialog-heading { padding: 16px; }
    .dialog-heading h2 { font-size: 16px; }
    .quick-search { margin-inline: 16px; }
    .quick-search > input { font-size: 16px; }
    .quick-results > a { font-size: 15px; min-height: 48px; }
    .dialog-hint { font-size: 10px; }
}

@media (max-width: 782px) {
    .admin-bar .site-header { top: 46px; }
    .js .admin-bar .sidebar-content { top: 112px; }
}

@media (max-width: 600px) {
    /* WordPress makes its toolbar absolute on phones; the site header stays at the viewport top after scrolling. */
    .admin-bar .site-header { top: 0; }
    .js .admin-bar .sidebar-content { top: 66px; }
}

@media (max-height: 600px) and (max-width: 1023px) {
    .sidebar-content.is-open .sidebar-label { display: none; }
    .js .sidebar-content { padding-top: 10px; }
    .primary-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 10px; }
    .sidebar-tools { margin-top: 14px; padding-top: 10px; }
    .sidebar-bottom { padding-top: 18px; }
    dialog { max-height: calc(100dvh - 24px); }
    .quick-find-dialog[open] { display: flex; flex-direction: column; }
    .quick-results { min-height: 0; }
    .dialog-heading, .quick-search, .dialog-hint { flex-shrink: 0; }
    .service-lab-dialog .lab-intro { display: none; }
    .service-lab-dialog .lab-heading { padding-block: 10px; }
    .service-lab-dialog .lab-heading .rail-label { display: none; }
    .service-lab-dialog .lab-status { max-height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    :root { color-scheme: light; --bg: #fff; --ink: #111; --muted: #444; --subtle: #555; --surface: #fff; --line: #ccc; --strong-line: #aaa; --logo-filter: brightness(0); }
    .site-header, .context-rail, .profile-actions, .work-filters, .copy-email, dialog { display: none !important; }
    .page-shell { margin: 0; }
    .portfolio-layout { display: block; max-width: none; padding: 25px; }
    .profile-section::before { display: none; }
    .portfolio-section { margin-top: 25px; padding-top: 20px; }
    .project-card, .service-card, .experience-item { break-inside: avoid; }
    .project-card { min-height: 145px; }
    .footer-inner { padding: 25px; }
}
