:root {
    --bg: #f5f5f7;
    --panel: #ffffff;
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --link: #0066cc;
    --line: rgba(0, 0, 0, 0.08);
    --control: #fbfbfd;
    --chip: #e8e8ed;
    --hero-glow: rgba(0, 102, 204, 0.28);
    --dark: #000000;
    --soft-dark: #101012;
    --radius: 28px;
    --max: 1180px;
}

body.dark-mode {
    --bg: #111114;
    --panel: #1b1b1f;
    --ink: #f5f5f7;
    --muted: #a1a1aa;
    --line: rgba(255, 255, 255, 0.12);
    --control: #24242a;
    --chip: #2a2a31;
    --hero-glow: rgba(79, 153, 255, 0.34);
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
    line-height: 1.45;
    overflow-x: hidden;
    transition: background-color 320ms ease, color 320ms ease;
}

body.modal-open {
    overflow: hidden;
}

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

a {
    color: inherit;
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 0;
    height: 3px;
    background: var(--link);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 34px;
    min-height: 46px;
    padding: 0 22px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(20px);
}

.brand {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--ink);
    font-size: 0.74rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.site-nav a {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--ink);
}

.theme-toggle {
    position: absolute;
    right: 22px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.command-button {
    position: absolute;
    right: 64px;
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.command-label {
    color: var(--ink);
}

.theme-toggle span {
    font-size: 1rem;
    line-height: 1;
}

.menu-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 16px;
    height: 1px;
    margin: 5px auto;
    background: var(--ink);
}

main {
    display: grid;
    gap: 12px;
}

.panel {
    position: relative;
    display: grid;
    min-height: 690px;
    overflow: hidden;
    isolation: isolate;
}

.dark-panel {
    background: var(--dark);
    color: #f5f5f7;
}

.light-panel {
    background: var(--panel);
}

.hero {
    perspective: 1200px;
    place-items: center;
    text-align: center;
}

.hero-copy,
.section-copy {
    position: relative;
    z-index: 2;
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 58px 0;
    text-align: center;
}

.hero-copy {
    transform: translate3d(var(--hero-x, 0px), var(--hero-y, 0px), 60px);
    transition: transform 180ms ease-out;
}

.kicker {
    color: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0;
}

h1,
h2,
h3 {
    letter-spacing: -0.025em;
    line-height: 1.04;
}

h1 {
    margin-top: 8px;
    font-size: clamp(3.4rem, 8vw, 7.2rem);
    font-weight: 800;
}

h2 {
    margin-top: 8px;
    font-size: clamp(2.6rem, 6vw, 5.4rem);
    font-weight: 800;
}

h3 {
    margin-top: 8px;
    font-size: clamp(2rem, 3.6vw, 3.2rem);
    font-weight: 800;
}

.hero-copy p:not(.kicker),
.section-copy p:not(.kicker),
.post-content p,
.notes-list p {
    margin-top: 14px;
    color: var(--muted);
    font-size: clamp(1.08rem, 2.2vw, 1.55rem);
    font-weight: 500;
}

.dark-panel .hero-copy p:not(.kicker),
.dark-tile .post-content p {
    color: rgba(245, 245, 247, 0.76);
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
    margin-top: 20px;
}

.link-row a,
.post-content a,
.site-footer a {
    color: var(--link);
    font-size: 1.12rem;
    font-weight: 500;
    text-decoration: none;
}

.link-row a::after,
.post-content a::after,
.site-footer a::after {
    content: ">";
    padding-left: 6px;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin-top: 48px;
    color: rgba(245, 245, 247, 0.62);
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

.hero-stats strong {
    display: block;
    color: #f5f5f7;
    font-size: 1.35rem;
}

.hero-visual {
    position: absolute;
    inset: auto 0 0;
    z-index: 1;
    height: 46%;
    opacity: 0.72;
    -webkit-mask-image: linear-gradient(transparent, #000 18%);
    mask-image: linear-gradient(transparent, #000 18%);
    transform: translate3d(var(--visual-x, 0px), var(--visual-y, 0px), -20px) scale(1.04);
    transition: transform 260ms ease-out;
}

.hero-visual img {
    height: 100%;
    object-fit: cover;
}

.hero::before,
.hero::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.hero::before {
    inset: 8% 18% auto;
    z-index: 0;
    height: 340px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    box-shadow:
        0 0 80px var(--hero-glow),
        inset 0 0 80px rgba(255, 255, 255, 0.04);
    transform: rotateX(64deg) rotateZ(var(--ring-rotation, 0deg)) translateZ(-30px);
    animation: orbit-ring 16s linear infinite;
}

.hero::after {
    top: 20%;
    left: 50%;
    z-index: 1;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #fff 0 2%, rgba(72, 164, 255, 0.95) 8%, rgba(0, 72, 180, 0.18) 48%, transparent 70%);
    filter: blur(1px);
    opacity: 0.75;
    transform: translate3d(calc(-50% + var(--orb-x, 0px)), var(--orb-y, 0px), 10px);
    animation: float-orb 7s ease-in-out infinite;
}

@keyframes orbit-ring {
    from { transform: rotateX(64deg) rotateZ(0deg) translateZ(-30px); }
    to { transform: rotateX(64deg) rotateZ(360deg) translateZ(-30px); }
}

@keyframes float-orb {
    0%, 100% { margin-top: -10px; }
    50% { margin-top: 18px; }
}

.reveal {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    transition: opacity 700ms ease, transform 700ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.latest-panel {
    place-items: start center;
    min-height: 760px;
    text-align: center;
}

.latest-panel img {
    align-self: end;
    width: min(920px, calc(100% - 32px));
    height: 390px;
    margin: -18px auto 54px;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.18);
}

.post-showcase,
.notes-panel,
.contact-panel,
.site-footer {
    width: min(var(--max), calc(100% - 24px));
    margin: 0 auto;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 56px 6px 18px;
}

.section-heading h2,
.notes-panel h2 {
    font-size: clamp(2.2rem, 4.8vw, 4.6rem);
}

.post-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 6px 18px;
}

.sort-field select {
    min-height: 42px;
    padding: 0 32px 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
}

.search-field {
    position: relative;
    display: block;
    width: min(360px, 100%);
}

.search-field input {
    width: 100%;
    min-height: 42px;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    outline: none;
}

.search-field input:focus {
    border-color: var(--link);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12);
}

.search-field span:last-child {
    position: absolute;
    top: 9px;
    right: 16px;
    color: var(--muted);
    font-size: 1.25rem;
}

.post-count {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.filter-chip {
    min-height: 34px;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--chip);
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.filter-chip.active {
    background: var(--ink);
    color: #fff;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.post-card {
    position: relative;
    display: grid;
    min-height: 620px;
    overflow: hidden;
    border-radius: var(--radius);
}

.post-card.hidden {
    display: none;
}

.post-card img {
    position: absolute;
    inset: auto 0 0;
    height: 50%;
    object-fit: cover;
}

.post-content {
    position: relative;
    z-index: 2;
    width: min(520px, calc(100% - 44px));
    margin: 0 auto;
    padding-top: 54px;
    text-align: center;
}

.post-content .kicker {
    font-size: 1rem;
}

.post-content a {
    display: inline-block;
    margin-top: 16px;
    font-size: 1rem;
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.post-content .text-button {
    display: inline-block;
    margin: 16px 0 0 12px;
    font-size: 1rem;
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.dark-tile .post-meta {
    color: rgba(245, 245, 247, 0.66);
}

.save-button {
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.save-button[aria-pressed="true"] {
    color: #e94b6a;
}

.save-button:focus-visible,
.filter-chip:focus-visible,
.theme-toggle:focus-visible,
.contact-form button:focus-visible {
    outline: 3px solid rgba(0, 102, 204, 0.35);
    outline-offset: 3px;
}

.empty-state {
    padding: 34px 6px 56px;
    color: var(--muted);
    font-size: 1.1rem;
    text-align: center;
}

.dark-tile {
    background: #000;
    color: #f5f5f7;
}

.light-tile {
    background: var(--panel);
}

.blue-tile {
    background: linear-gradient(180deg, #eef6ff 0%, var(--panel) 58%);
}

.about-panel {
    min-height: 560px;
    place-items: center;
    background: linear-gradient(180deg, var(--panel) 0%, var(--bg) 100%);
}

.platform-panel,
.newsletter-panel {
    width: min(var(--max), calc(100% - 24px));
    margin: 0 auto;
}

.platform-panel {
    padding: 74px 6px 20px;
}

.compact-heading {
    padding-top: 0;
}

.section-intro {
    max-width: 330px;
    color: var(--muted);
    font-size: 1rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.project-card {
    min-height: 350px;
    padding: 30px;
    border-radius: var(--radius);
    background: var(--panel);
}

.project-card-dark {
    background: #000;
    color: #f5f5f7;
}

.project-card h3 {
    margin-top: 12px;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.project-card > p:not(.kicker) {
    margin-top: 12px;
    color: var(--muted);
}

.project-card-dark > p:not(.kicker) {
    color: rgba(245, 245, 247, 0.7);
}

.project-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--link);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
}

.project-details {
    display: inline-block;
    margin-top: 58px;
}

.notes-list article {
    display: flex;
    flex-direction: column;
}

.copy-note {
    align-self: flex-start;
    margin-top: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.newsletter-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 12px;
    padding: 52px;
    border-radius: var(--radius);
    background: #dcecff;
}

.newsletter-panel h2 {
    max-width: 600px;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
}

.newsletter-panel p:not(.kicker) {
    max-width: 510px;
    margin-top: 14px;
    color: #53627a;
    font-size: 1.15rem;
}

.newsletter-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.newsletter-form input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    font: inherit;
}

.newsletter-form button {
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--panel);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.newsletter-form .form-status {
    grid-column: 1 / -1;
}

body.dark-mode .project-card,
body.dark-mode .newsletter-panel {
    background: #202a38;
}

body.dark-mode .project-card-dark {
    background: #000;
}

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 60;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--ink);
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.reading-modal,
.project-modal,
.command-palette {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 18px;
}

[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
}

.modal-card,
.palette-card {
    position: relative;
    z-index: 1;
    width: min(700px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    padding: 46px;
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.8rem;
    cursor: pointer;
}

.reading-card h2,
.modal-card h2 {
    max-width: 600px;
    margin-top: 10px;
    font-size: clamp(2.5rem, 6vw, 5rem);
}

.reading-lede,
.modal-card > p:not(.kicker) {
    margin-top: 16px;
    color: var(--muted);
    font-size: 1.25rem;
}

.reading-body {
    margin-top: 30px;
    color: var(--ink);
    font-size: 1.1rem;
}

.reading-body p + p {
    margin-top: 18px;
}

.reading-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 38px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.project-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 34px;
}

.project-facts span {
    padding: 16px;
    border-radius: 16px;
    background: var(--bg);
    color: var(--muted);
    font-size: 0.82rem;
}

.project-facts strong {
    display: block;
    margin-top: 5px;
    color: var(--ink);
    font-size: 1rem;
}

.palette-card {
    width: min(560px, 100%);
    padding: 18px;
}

.palette-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 14px;
}

.palette-heading h2 {
    margin: 0;
    font-size: 1.3rem;
}

.palette-card > input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    outline: none;
}

.command-list {
    display: grid;
    gap: 4px;
    margin-top: 12px;
}

.command-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.command-list button:hover {
    background: var(--bg);
}

kbd {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--muted);
    font-size: 0.72rem;
}

.palette-hint {
    margin: 15px 8px 3px;
    color: var(--muted);
    font-size: 0.78rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 300;
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--panel);
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.interest-strip {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: min(860px, calc(100% - 28px));
    margin: -34px auto 58px;
}

.interest-strip span {
    padding: 10px 15px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--line);
}

.notes-panel {
    padding: 70px 6px 54px;
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.notes-list article {
    min-height: 260px;
    padding: 28px;
    border-radius: var(--radius);
    background: var(--panel);
}

body.dark-mode .site-header,
body.dark-mode .site-nav {
    background: rgba(17, 17, 20, 0.92);
}

body.dark-mode .light-panel,
body.dark-mode .light-tile,
body.dark-mode .notes-list article,
body.dark-mode .contact-panel > .section-copy,
body.dark-mode .contact-form {
    background: var(--panel);
}

body.dark-mode .blue-tile,
body.dark-mode .about-panel {
    background: linear-gradient(180deg, #202a38 0%, #1b1b1f 100%);
}

body.dark-mode .interest-strip span {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .newsletter-panel {
    background: linear-gradient(135deg, #182d49, #202a38);
}

body.dark-mode .newsletter-panel p:not(.kicker) {
    color: #c0ccdc;
}

body.dark-mode .newsletter-form input {
    background: var(--control);
}

.post-card,
.project-card,
.notes-list article,
.contact-panel > .section-copy,
.contact-form,
.newsletter-panel {
    transition: transform 350ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 350ms ease, background-color 320ms ease;
    transform-style: preserve-3d;
}

.post-card:hover,
.project-card:hover,
.notes-list article:hover {
    transform: translateY(-8px) rotateX(1deg) rotateY(-1deg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
}

body.dark-mode .post-card:hover,
body.dark-mode .project-card:hover,
body.dark-mode .notes-list article:hover {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.46);
}

.notes-list span {
    color: var(--link);
    font-size: 0.92rem;
    font-weight: 700;
}

.notes-list p {
    color: var(--ink);
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    line-height: 1.14;
}

.contact-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.contact-panel > .section-copy,
.contact-form {
    border-radius: var(--radius);
    background: var(--panel);
}

.contact-panel > .section-copy {
    display: grid;
    align-content: center;
    width: 100%;
    min-height: 470px;
    padding: 42px;
}

.contact-form {
    display: grid;
    gap: 16px;
    min-height: 470px;
    padding: 42px;
}

.contact-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--control);
    color: var(--ink);
    font: inherit;
    padding: 14px 15px;
    outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    border-color: var(--link);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12);
}

.contact-form button {
    justify-self: start;
    min-height: 44px;
    padding: 10px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--link);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.form-status {
    min-height: 24px;
    color: var(--link);
    font-weight: 600;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 6px 34px;
    color: var(--muted);
    font-size: 0.86rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* Minimal editorial layer */
:root {
    --bg: #f7f7f5;
    --panel: #ffffff;
    --ink: #171717;
    --muted: #777773;
    --link: #155eef;
    --line: #e7e7e2;
    --control: #fafaf8;
    --chip: #eeeeea;
    --radius: 18px;
    --max: 1120px;
}

body.dark-mode {
    --bg: #101010;
    --panel: #171717;
    --ink: #f2f2ed;
    --muted: #a1a19b;
    --link: #82aaff;
    --line: #2a2a27;
    --control: #1d1d1b;
    --chip: #242421;
}

body {
    background: var(--bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -0.01em;
}

main {
    gap: 0;
}

.site-header {
    min-height: 64px;
    justify-content: space-between;
    gap: 24px;
    width: min(var(--max), calc(100% - 40px));
    margin: 0 auto;
    padding: 0;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    border-bottom: 1px solid var(--line);
}

.brand {
    width: auto;
    height: auto;
    font-size: 0.9rem;
    letter-spacing: -0.04em;
}

.site-nav {
    gap: 22px;
}

.site-nav a {
    color: var(--muted);
    font-size: 0.78rem;
    transition: color 160ms ease;
}

.site-nav a:hover {
    color: var(--ink);
}

.theme-toggle,
.command-button {
    position: static;
}

.theme-toggle {
    width: 30px;
    flex: 0 0 30px;
    border-color: var(--line);
}

.command-button {
    display: none;
}

.hero {
    min-height: min(760px, calc(100vh - 64px));
    place-items: center;
    background: var(--bg);
    color: var(--ink);
}

.hero-visual {
    height: 30%;
    opacity: 0.14;
    filter: grayscale(1);
    -webkit-mask-image: linear-gradient(transparent, #000 35%, transparent);
    mask-image: linear-gradient(transparent, #000 35%, transparent);
}

.hero::before {
    inset: auto 15% 13%;
    height: 180px;
    border-color: color-mix(in srgb, var(--ink) 12%, transparent);
    box-shadow: none;
    opacity: 0.5;
}

.hero::after {
    width: 90px;
    height: 90px;
    opacity: 0.2;
    filter: grayscale(1);
}

.hero-copy {
    width: min(860px, calc(100% - 40px));
    padding: 60px 0;
}

.kicker {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 880px;
    margin: 18px auto 0;
    font-size: clamp(3.1rem, 7.2vw, 6.8rem);
    letter-spacing: -0.075em;
    line-height: 0.96;
}

h2 {
    letter-spacing: -0.065em;
}

h3 {
    letter-spacing: -0.05em;
}

.hero-copy p:not(.kicker),
.section-copy p:not(.kicker),
.post-content p,
.notes-list p {
    color: var(--muted);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    line-height: 1.55;
}

.dark-panel .hero-copy p:not(.kicker),
.dark-tile .post-content p {
    color: var(--muted);
}

.link-row {
    gap: 18px;
    margin-top: 28px;
}

.link-row a,
.post-content a,
.site-footer a {
    font-size: 0.9rem;
    font-weight: 700;
}

.hero-stats {
    gap: 28px;
    margin-top: 64px;
    color: var(--muted);
    font-size: 0.75rem;
}

.hero-stats strong {
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 700;
}

.latest-panel {
    min-height: 0;
    padding: 120px 0;
    background: var(--panel);
}

.latest-panel .section-copy {
    width: min(760px, calc(100% - 40px));
    padding: 0 0 44px;
}

.latest-panel h2 {
    font-size: clamp(2.5rem, 5.2vw, 5rem);
}

.latest-panel img {
    width: min(820px, calc(100% - 40px));
    height: 340px;
    margin: 0 auto;
    border-radius: 14px;
    filter: saturate(0.75);
    box-shadow: none;
}

.post-showcase,
.notes-panel,
.contact-panel,
.site-footer,
.platform-panel,
.newsletter-panel {
    width: min(var(--max), calc(100% - 40px));
}

.section-heading {
    padding: 108px 0 28px;
}

.section-heading h2,
.notes-panel h2 {
    font-size: clamp(2.3rem, 4.2vw, 4rem);
}

.post-tools {
    padding: 0 0 18px;
}

.search-field {
    width: min(320px, 100%);
}

.search-field input,
.sort-field select {
    min-height: 38px;
    border-color: var(--line);
    background: var(--control);
}

.filter-chip {
    min-height: 32px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    font-size: 0.78rem;
}

.filter-chip.active {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.tile-grid {
    gap: 10px;
}

.post-card {
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.post-card img {
    opacity: 0.72;
    filter: saturate(0.65);
}

.post-content {
    width: min(470px, calc(100% - 48px));
    padding-top: 42px;
}

.post-content h3 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.post-meta {
    font-size: 0.76rem;
}

.about-panel {
    min-height: 480px;
    margin-top: 100px;
    border-top: 1px solid var(--line);
    background: var(--bg);
}

.about-panel .section-copy {
    padding: 70px 0 40px;
}

.interest-strip {
    margin: -8px auto 58px;
}

.interest-strip span {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--line);
    box-shadow: none;
    font-size: 0.78rem;
}

.platform-panel {
    padding: 112px 0 0;
}

.compact-heading {
    padding: 0 0 28px;
}

.project-grid,
.notes-list {
    gap: 10px;
}

.project-card,
.notes-list article {
    min-height: 300px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.project-card-dark {
    background: var(--ink);
    color: var(--bg);
}

.project-card h3 {
    font-size: clamp(1.7rem, 2.8vw, 2.4rem);
}

.project-details {
    margin-top: 44px;
    font-size: 0.85rem;
}

.notes-panel {
    padding: 112px 0 48px;
}

.notes-list p {
    font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.newsletter-panel {
    margin-top: 64px;
    padding: 42px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.newsletter-panel h2 {
    font-size: clamp(2.3rem, 4.5vw, 4.2rem);
}

.newsletter-panel p:not(.kicker) {
    color: var(--muted);
    font-size: 1rem;
}

.newsletter-form input {
    min-height: 44px;
    border: 1px solid var(--line);
    background: var(--control);
}

.newsletter-form button {
    min-height: 44px;
    background: var(--ink);
    color: var(--bg);
}

.contact-panel {
    margin-top: 64px;
}

.contact-panel > .section-copy,
.contact-form {
    min-height: 420px;
    border: 1px solid var(--line);
}

.contact-panel > .section-copy,
.contact-form {
    padding: 34px;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
    border-radius: 10px;
}

.site-footer {
    padding: 34px 0 42px;
    border-top: 1px solid var(--line);
}

.back-to-top {
    right: 20px;
    bottom: 20px;
    width: 38px;
    height: 38px;
}

.post-card:hover,
.project-card:hover,
.notes-list article:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.08);
}

body.dark-mode .post-card:hover,
body.dark-mode .project-card:hover,
body.dark-mode .notes-list article:hover {
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

@media (max-width: 860px) {
    .site-header {
        width: calc(100% - 32px);
    }

    .site-nav {
        background: var(--bg);
        border: 1px solid var(--line);
        border-top: 0;
    }

    .section-heading,
    .compact-heading {
        padding-top: 76px;
    }

    .about-panel {
        margin-top: 72px;
    }
}

@media (max-width: 540px) {
    .site-header,
    .post-showcase,
    .notes-panel,
    .contact-panel,
    .site-footer,
    .platform-panel,
    .newsletter-panel {
        width: calc(100% - 28px);
    }

    .site-nav {
        left: 0;
        width: 100%;
        padding: 8px 18px 14px;
    }

    .hero {
        min-height: 680px;
    }

    .hero-copy {
        width: min(100% - 28px, 680px);
    }

    .hero h1 {
        font-size: clamp(3rem, 16vw, 4.4rem);
    }

    .latest-panel {
        padding: 78px 0;
    }

    .latest-panel img {
        height: 240px;
    }

    .newsletter-panel {
        padding: 28px;
    }
}

body.dark-mode .project-card:not(.project-card-dark),
body.dark-mode .notes-list article {
    background: var(--panel);
}

body.dark-mode .newsletter-panel {
    background: var(--panel);
}

.admin-page {
    min-height: 100vh;
    padding: 0 20px 70px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1080px, 100%);
    min-height: 92px;
    margin: 0 auto 42px;
    border-bottom: 1px solid var(--line);
}

.admin-header-copy {
    flex: 1;
}

.admin-header h1 {
    margin-top: 4px;
    font-size: clamp(1.7rem, 4vw, 2.7rem);
    letter-spacing: -0.06em;
}

.admin-site-link {
    color: var(--link);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 14px;
    width: min(1080px, 100%);
    margin: 0 auto;
}

.admin-login {
    width: min(430px, 100%);
    margin: 0 auto 28px;
}

.admin-login h2 {
    margin-bottom: 26px;
}

.admin-logout {
    position: absolute;
    top: 28px;
    right: 34px;
    border: 0;
    background: transparent;
    color: #d14343;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.admin-card,
.admin-help {
    position: relative;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-card[hidden],
.admin-login[hidden] {
    display: none;
}

.admin-card:first-child {
    grid-row: span 2;
}

.admin-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.admin-card h2,
.admin-help h2 {
    margin-top: 8px;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.admin-badge,
.admin-count {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-form {
    display: grid;
    gap: 18px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.admin-form input,
.admin-form textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--control);
    color: var(--ink);
    font: inherit;
    padding: 12px 14px;
    outline: none;
}

.admin-form input:focus,
.admin-form textarea:focus {
    border-color: var(--link);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

.admin-primary-button,
.admin-secondary-button {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.admin-primary-button {
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--bg);
}

.admin-secondary-button {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
}

.admin-status {
    min-height: 20px;
    color: var(--link);
    font-size: 0.82rem;
    font-weight: 700;
}

.topic-form {
    margin-bottom: 28px;
}

.topic-manager {
    display: grid;
    gap: 8px;
}

.topic-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.topic-manager-item strong {
    font-size: 1rem;
}

.topic-manager-item p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
}

.topic-delete {
    border: 0;
    background: transparent;
    color: #d14343;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.admin-help {
    align-self: start;
    background: var(--ink);
    color: var(--bg);
}

.admin-help .kicker {
    color: color-mix(in srgb, var(--bg) 60%, transparent);
}

.admin-help p:not(.kicker) {
    margin-top: 18px;
    color: color-mix(in srgb, var(--bg) 70%, transparent);
    font-size: 1rem;
    line-height: 1.6;
}

.admin-help a {
    display: inline-block;
    margin-top: 26px;
    color: var(--bg);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 760px) {
    .admin-page {
        padding: 0 14px 44px;
    }

    .admin-header {
        margin-bottom: 24px;
    }

    .admin-header .brand {
        align-self: flex-start;
        margin-top: 28px;
    }

    .admin-header-copy {
        padding: 24px 0;
    }

    .admin-site-link {
        align-self: flex-start;
        margin-top: 28px;
    }

    .admin-layout,
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-card:first-child {
        grid-row: auto;
    }

    .admin-card,
    .admin-help {
        padding: 24px;
    }
}

.site-footer a {
    font-size: 0.86rem;
}

.site-footer > div {
    display: flex;
    align-items: center;
    gap: 18px;
}

.saved-summary {
    color: var(--muted);
}

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

@media (max-width: 860px) {
    .site-header {
        justify-content: space-between;
    }

    .menu-toggle {
        display: block;
    }

    .site-nav {
        position: absolute;
        top: 46px;
        left: 0;
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 14px 22px 20px;
        background: rgba(245, 245, 247, 0.96);
        backdrop-filter: saturate(180%) blur(20px);
    }

    .theme-toggle {
        right: 66px;
    }

    .command-button {
        right: 108px;
    }

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

    .site-nav a {
        padding: 14px 0;
        border-bottom: 1px solid var(--line);
        font-size: 1.1rem;
    }

    .panel {
        min-height: 640px;
    }

    .hero-visual {
        height: 40%;
    }

    .section-heading,
    .contact-panel,
    .notes-list,
    .tile-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        display: grid;
        align-items: start;
    }

    .post-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .post-tools .sort-field select {
        width: 100%;
    }

    .project-grid,
    .newsletter-panel {
        grid-template-columns: 1fr;
    }

    .filter-row {
        justify-content: flex-start;
    }

    .post-card {
        min-height: 560px;
    }
}

@media (max-width: 540px) {
    .hero-copy,
    .section-copy {
        padding-top: 42px;
    }

    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2.45rem;
    }

    .latest-panel img {
        height: 280px;
    }

    .contact-panel > .section-copy,
    .contact-form,
    .notes-list article,
    .newsletter-panel,
    .modal-card {
        padding: 26px;
    }

    .site-footer,
    .site-footer > div {
        flex-direction: column;
        align-items: flex-start;
    }

    .command-button {
        display: none;
    }

    .reading-footer,
    .project-facts {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}
