/* ============================================================
   LusitanIO — editorial dark, single azulejo accent
   + experience layer: cursor, kinetic type, living mosaic
   ============================================================ */

:root {
    /* Palette */
    --bg:           #0d0f14;
    --bg-elev:      #15181f;
    --bg-card:      #181c25;
    --ink:          #ece9e0;
    --ink-muted:    #8e8f99;
    --ink-faded:    #696c78;
    --rule:         rgba(236, 233, 224, 0.08);
    --rule-strong:  rgba(236, 233, 224, 0.14);

    /* The one accent */
    --azulejo:        #5b8ed3;
    --azulejo-deep:   #2c5c9c;
    --azulejo-pale:   rgba(91, 142, 211, 0.10);
    --azulejo-glow:   rgba(91, 142, 211, 0.22);

    /* Used sparingly — blog tags, quote marks */
    --terracotta:   #d27a55;

    /* Type */
    --serif:  'Fraunces', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
    --sans:   'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono:   'JetBrains Mono', 'Space Mono', ui-monospace, SFMono-Regular, monospace;

    /* Rhythm */
    --measure: 62ch;
    --gutter:  clamp(1.25rem, 4vw, 4rem);
    --section: clamp(5rem, 10vw, 9rem);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    overflow-x: hidden;
    font-feature-settings: "ss01", "cv02", "cv11";
}

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

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

::selection { background: var(--azulejo); color: var(--bg); }

:focus-visible {
    outline: 2px solid var(--azulejo);
    outline-offset: 3px;
    border-radius: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 200;
    background: var(--azulejo);
    color: var(--bg);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.skip-link:focus {
    left: var(--gutter);
    top: 0.75rem;
}

/* ---------- Background signature: subtle azulejo lattice ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'><g fill='none' stroke='%235b8ed3' stroke-width='0.4' opacity='0.18'><path d='M48 0 L96 48 L48 96 L0 48 Z'/><path d='M48 16 L80 48 L48 80 L16 48 Z'/><circle cx='48' cy='48' r='3'/></g></svg>");
    background-size: 96px 96px;
    background-position: 0 var(--drift, 0px);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 80% -10%, var(--azulejo-glow), transparent 55%),
        radial-gradient(ellipse at -10% 100%, rgba(44, 92, 156, 0.16), transparent 60%);
}

main, nav, footer { position: relative; z-index: 1; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: var(--ink);
    font-feature-settings: "ss01", "ss02";
}

h1 { font-size: clamp(2.75rem, 6vw + 0.5rem, 5.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.12; }
h3 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -0.015em; }
h4 { font-size: 1.05rem; font-family: var(--sans); font-weight: 600; letter-spacing: -0.005em; }

em, .italic { font-style: italic; font-variation-settings: "SOFT" 80; color: var(--ink); }

p { max-width: var(--measure); }

.mono {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--azulejo);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.eyebrow::before {
    content: '';
    width: 1.5rem;
    height: 1px;
    background: var(--azulejo);
}

.lede {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.2rem, 1.6vw, 1.5rem);
    line-height: 1.45;
    color: var(--ink);
    max-width: 38ch;
    letter-spacing: -0.01em;
}

.muted { color: var(--ink-muted); }

/* ---------- Layout ---------- */
.shell {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

section {
    padding-block: var(--section);
}

.rule {
    border-top: 1px solid var(--rule);
}

/* ---------- Navigation ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 15, 20, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--rule);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 0;
}

.brand {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--ink);
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
}

.tile {
    width: 9px;
    height: 9px;
    border: 1px solid var(--azulejo);
    background: var(--azulejo-pale);
    display: inline-block;
    flex-shrink: 0;
    transform: rotate(45deg);
}

.brand .tile {
    align-self: center;
    margin-right: 0.6rem;
    transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1), background 0.3s ease;
}

.brand:hover .tile {
    transform: rotate(225deg);
    background: var(--azulejo);
}

.brand em {
    font-style: italic;
    color: var(--azulejo);
    font-weight: 400;
}

.nav-links {
    display: flex;
    gap: 2.25rem;
    list-style: none;
}

.nav-links a {
    font-size: 0.92rem;
    color: var(--ink-muted);
    transition: color 0.2s ease;
    position: relative;
    padding-block: 0.25rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--ink);
}

.nav-links a[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--azulejo);
}

.nav-cta {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.nav-cta:hover {
    border-color: var(--azulejo);
    color: var(--azulejo);
    background: var(--azulejo-pale);
}

.nav-burger {
    display: none;
    background: none;
    border: none;
    color: var(--ink);
    cursor: pointer;
    padding: 0.5rem;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
}

.lang-switch .current { color: var(--azulejo); }

.lang-switch a {
    color: var(--ink-faded);
    transition: color 0.2s ease;
}

.lang-switch a:hover { color: var(--ink); }

.lang-switch .sep {
    color: var(--ink-faded);
    opacity: 0.6;
}

/* ---------- Buttons / links ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--sans);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.85rem 1.4rem;
    border-radius: 2px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--azulejo);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--ink);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
}

.btn-ghost:hover {
    border-color: var(--azulejo);
    color: var(--azulejo);
}

.arrow-link {
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--azulejo);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.2s ease;
}

.arrow-link::after {
    content: '→';
    transition: transform 0.2s ease;
}

.arrow-link:hover { gap: 0.85rem; }
.arrow-link:hover::after { transform: translateX(2px); }

/* ============================================================
   HOMEPAGE
   ============================================================ */

/* ---------- Hero ---------- */
.hero {
    padding-top: clamp(4rem, 8vw, 7rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
}

.hero h1 {
    margin-top: 1.5rem;
}

.hero h1 .accent {
    font-style: italic;
    color: var(--azulejo);
    font-variation-settings: "SOFT" 100;
}

.hero-meta {
    margin-top: clamp(2.5rem, 6vw, 4.5rem);
    padding-top: 1.75rem;
    border-top: 1px solid var(--rule-strong);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem 2.5rem;
}

.hero-meta dt {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faded);
    margin-bottom: 0.25rem;
}

.hero-meta dd {
    font-size: 0.95rem;
    color: var(--ink);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

/* ---------- What we do (3 pillars) ---------- */
.pillars-head {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
    margin-bottom: 4rem;
}

.pillars {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid var(--rule);
}

.pillar {
    display: grid;
    grid-template-columns: 5rem 1fr 1fr auto;
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--rule);
    position: relative;
    transition: background 0.3s ease;
}

.pillar::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), var(--azulejo-glow), transparent 70%);
    transition: opacity 0.35s ease;
}

.pillar:hover::after {
    opacity: 1;
}

.pillar-num {
    font-family: var(--serif);
    font-style: italic;
    font-size: 2.5rem;
    color: var(--azulejo);
    line-height: 1;
    font-weight: 300;
}

.pillar-body h3 {
    margin-bottom: 0.5rem;
}

.pillar-body p {
    color: var(--ink-muted);
    font-size: 0.98rem;
    max-width: 38ch;
}

.pillar-tags {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pillar-tags li {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pillar-tags li::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--azulejo);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.pillar-link {
    align-self: center;
}

/* ---------- Approach ---------- */
.approach-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: start;
}

.approach-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.approach-step {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 1.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
}

.approach-step:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.approach-step .step-num {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--azulejo);
    letter-spacing: 0.1em;
    padding-top: 0.4rem;
}

.approach-step h3 {
    margin-bottom: 0.5rem;
}

.approach-step p {
    color: var(--ink-muted);
    font-size: 0.97rem;
}

/* ---------- Writing preview (blog teaser on homepage) ---------- */
.writing-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 3rem;
    gap: 2rem;
    flex-wrap: wrap;
}

.writing-list {
    list-style: none;
    border-top: 1px solid var(--rule);
}

.writing-list a {
    display: grid;
    grid-template-columns: 9rem 1fr auto;
    gap: 2rem;
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: baseline;
    transition: padding-left 0.25s ease;
}

.writing-list a:hover {
    padding-left: 1rem;
}

.writing-list time {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faded);
}

.writing-list h3 {
    font-size: 1.25rem;
    color: var(--ink);
    transition: color 0.2s ease;
}

.writing-list a:hover h3 {
    color: var(--azulejo);
}

.writing-list .tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--terracotta);
}

/* ---------- Contact / final ---------- */
.contact {
    padding-block: var(--section);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
}

.contact h2 {
    max-width: 14ch;
}

.contact-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.contact-side a {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--azulejo);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
    transition: color 0.2s ease;
}

.contact-side a:hover {
    color: var(--ink);
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--rule);
    padding: 3rem 0 2.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.footer-tag {
    font-family: var(--serif);
    font-style: italic;
    color: var(--ink-muted);
    font-size: 1rem;
    margin-top: 0.5rem;
    max-width: 32ch;
}

.footer-col h5 {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faded);
    margin-bottom: 1rem;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-col a {
    color: var(--ink-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-col a:hover { color: var(--azulejo); }

.footer-bottom {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faded);
}

/* ============================================================
   SERVICE PAGES
   ============================================================ */

.page-hero {
    padding-top: clamp(4rem, 7vw, 6rem);
    padding-bottom: clamp(3rem, 5vw, 4rem);
}

.page-hero .eyebrow { margin-bottom: 1.5rem; }

.page-hero h1 {
    max-width: 16ch;
    margin-bottom: 1.5rem;
}

.page-hero .lede {
    max-width: 48ch;
    margin-top: 1.5rem;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: start;
}

.split-sticky {
    position: sticky;
    top: 6rem;
}

.feature-list {
    list-style: none;
    border-top: 1px solid var(--rule);
}

.feature-list li {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 1.25rem;
    align-items: baseline;
}

.feature-list .n {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--azulejo);
    letter-spacing: 0.1em;
}

.feature-list h4 { margin-bottom: 0.35rem; }

.feature-list p {
    color: var(--ink-muted);
    font-size: 0.97rem;
}

.kicker-cta {
    margin-top: 4rem;
    padding: 3rem;
    border: 1px solid var(--rule);
    background: linear-gradient(135deg, var(--azulejo-pale), transparent 70%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.kicker-cta h3 { max-width: 22ch; font-size: 1.6rem; }

/* ============================================================
   BLOG
   ============================================================ */

.blog-head {
    display: grid;
    grid-template-columns: 1fr 0.6fr;
    gap: clamp(2rem, 6vw, 5rem);
    align-items: end;
    margin-bottom: 4rem;
}

.blog-head h1 { max-width: 12ch; }

.blog-head .lede { max-width: 36ch; }

.post-list {
    list-style: none;
    border-top: 1px solid var(--rule);
}

.post-list article {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--rule);
}

.post-list article > a {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: start;
    transition: transform 0.25s ease;
}

.post-list article > a:hover {
    transform: translateX(6px);
}

.post-list .meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-list time {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faded);
}

.post-list .tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--terracotta);
}

.post-list h2 {
    font-size: 1.85rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s ease;
}

.post-list article > a:hover h2 {
    color: var(--azulejo);
}

.post-list p {
    color: var(--ink-muted);
    max-width: 56ch;
}

/* ---------- Article (single post) ---------- */
.article-hero {
    padding-top: clamp(3rem, 6vw, 5rem);
    padding-bottom: clamp(2rem, 4vw, 3rem);
    max-width: 760px;
    margin: 0 auto;
}

.article-hero .eyebrow { margin-bottom: 1.5rem; }

.article-hero h1 {
    font-size: clamp(2.2rem, 4.5vw, 3.5rem);
    margin-bottom: 1.5rem;
}

.article-hero .lede {
    max-width: 100%;
}

.article-meta {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    display: flex;
    gap: 2rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faded);
    flex-wrap: wrap;
}

.article-meta .tag { color: var(--terracotta); }

.article-body {
    max-width: 720px;
    margin: 0 auto;
    padding-block: clamp(2rem, 5vw, 4rem);
    padding-inline: var(--gutter);
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body figure {
    margin-bottom: 1.5rem;
}

.article-body p {
    font-size: 1.13rem;
    line-height: 1.75;
    color: var(--ink);
    max-width: none;
}

.article-body h2 {
    font-size: 1.85rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.article-body h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-body ul, .article-body ol {
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.article-body a {
    color: var(--azulejo);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.article-body a:hover { color: var(--ink); }

.article-body blockquote {
    border-left: 2px solid var(--azulejo);
    padding: 0.5rem 0 0.5rem 1.5rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--ink);
}

.article-body code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--bg-elev);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: var(--azulejo);
}

.article-body pre {
    background: var(--bg-elev);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: var(--ink);
    font-size: 0.88rem;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 3rem auto;
    max-width: 6rem;
}

.article-foot {
    max-width: 720px;
    margin: 0 auto;
    padding-block: 3rem;
    padding-inline: var(--gutter);
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

/* ============================================================
   Reveal animations
   ============================================================ */

/* Hidden state only applies once JS has booted — content stays
   readable without scripts. --rd is a per-element stagger delay. */
html.js .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: var(--rd, 0ms);
}

html.js .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 960px) {
    .nav-links { display: none; }
    .nav-burger { display: inline-flex; }

    .hero-grid,
    .pillars-head,
    .approach-grid,
    .contact-grid,
    .split,
    .blog-head { grid-template-columns: 1fr; }

    .split-sticky { position: static; }

    .hero-visual { max-width: 560px; }

    .pillar {
        grid-template-columns: 3rem 1fr;
        grid-template-areas:
            "num body"
            ".   tags"
            ".   link";
        gap: 1rem;
    }
    .pillar-num { grid-area: num; font-size: 1.8rem; }
    .pillar-body { grid-area: body; }
    .pillar-tags { grid-area: tags; flex-direction: row; flex-wrap: wrap; }
    .pillar-link { grid-area: link; justify-self: start; }

    .writing-list a {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }

    .post-list article > a { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; gap: 1rem; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .btn { justify-content: center; }
    .nav-cta { display: none; }
}

/* ---------- Mobile menu drawer (toggled by JS) ---------- */
.nav-drawer {
    display: none;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--rule);
}

.nav-drawer.open {
    display: block;
}

.nav-drawer ul {
    list-style: none;
    padding: 1rem var(--gutter);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-drawer a {
    color: var(--ink);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rule);
    display: block;
    font-size: 1rem;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */

.about-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(2rem, 6vw, 5rem);
    align-items: end;
}

.about-meta {
    margin-top: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--ink-faded);
}

.about-meta span:not(:first-child):not(:last-child) {
    color: var(--ink-faded);
}

/* Studio emblem — a living mosaic with a ceramic-style plaque,
   in place of the team photo. */
.about-emblem { position: relative; }

.emblem-frame { position: relative; }

.emblem-plaque {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.25rem;
    background: rgba(13, 15, 20, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--rule-strong);
    white-space: nowrap;
}

.emblem-plaque .tile {
    width: 11px;
    height: 11px;
}

.emblem-plaque .mono {
    letter-spacing: 0.16em;
    color: var(--ink-muted);
}

.about-prose {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: clamp(2rem, 6vw, 5rem);
    align-items: start;
}

.prose p {
    font-family: var(--serif);
    font-weight: 300;
    font-size: 1.2rem;
    line-height: 1.6;
    letter-spacing: -0.005em;
    color: var(--ink);
    max-width: 56ch;
    margin-bottom: 1.25rem;
}

.prose p:last-child { margin-bottom: 0; }

/* Principles */
.principles-head {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
    margin-bottom: 4rem;
}

.principles {
    list-style: none;
    border-top: 1px solid var(--rule);
    counter-reset: principle;
}

.principles li {
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 2rem;
    padding: 2.25rem 0;
    border-bottom: 1px solid var(--rule);
    align-items: start;
}

.p-num {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: 2.25rem;
    line-height: 1;
    color: var(--azulejo);
}

.principles h3 { margin-bottom: 0.5rem; }
.principles p { color: var(--ink-muted); font-size: 1rem; max-width: 56ch; }

/* Timeline */
.timeline {
    list-style: none;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--rule-strong);
    padding-left: 1.75rem;
}

.timeline li {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1.5rem;
    padding: 0.5rem 0 1.5rem;
    align-items: baseline;
    position: relative;
}

.timeline li::before {
    content: '';
    position: absolute;
    left: -1.875rem;
    top: 0.85rem;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--azulejo);
    box-shadow: 0 0 0 4px var(--bg);
}

.t-date {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--azulejo);
    text-transform: uppercase;
}

.timeline h4 { margin-bottom: 0.25rem; }
.timeline p { color: var(--ink-muted); font-size: 0.95rem; max-width: 48ch; }

/* Off-clock */
.off-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.off-list li {
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--rule);
}

.off-list li:last-child { border-bottom: none; }
.off-list h4 { margin-bottom: 0.4rem; }
.off-list p { color: var(--ink-muted); font-size: 0.97rem; max-width: 50ch; }

/* ============================================================
   WORK / CASE STUDIES
   ============================================================ */

.case-list {
    list-style: none;
    border-top: 1px solid var(--rule);
}

.case-list article {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--rule);
}

.case-list article > a {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: start;
    transition: transform 0.25s ease;
}

.case-list article > a:hover { transform: translateX(6px); }

.case-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.case-year {
    color: var(--ink-faded);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
}

.case-body h2 {
    font-size: 1.85rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s ease;
}

.case-list article > a:hover .case-body h2 { color: var(--azulejo); }

.case-body p {
    color: var(--ink-muted);
    max-width: 56ch;
}

.case-outcomes {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.case-outcomes strong {
    font-family: var(--mono);
    font-weight: 500;
    color: var(--azulejo);
    margin-right: 0.4rem;
}

.case-empty {
    padding: 2rem 0;
    border-bottom: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: start;
    opacity: 0.55;
}

/* Case study detail page */

.snapshot {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-block: 1rem;
}

.snapshot dt {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faded);
    margin-bottom: 0.4rem;
}

.snapshot dd {
    font-size: 0.98rem;
    color: var(--ink);
    line-height: 1.4;
}

.case-section {
    max-width: 880px;
}

.outcomes {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
}

.outcomes li {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.o-num {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    line-height: 1;
    color: var(--azulejo);
    letter-spacing: -0.02em;
}

.o-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.case-quote {
    margin-top: 3rem;
    border-left: 2px solid var(--azulejo);
    padding: 0.5rem 0 0.5rem 1.75rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--ink);
    max-width: 60ch;
}

.case-quote cite {
    display: block;
    margin-top: 0.75rem;
    font-style: normal;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faded);
}

/* ============================================================
   Responsive overrides for About + Work
   ============================================================ */

@media (max-width: 960px) {
    .about-hero,
    .about-prose,
    .principles-head { grid-template-columns: 1fr; }

    .about-emblem { max-width: 480px; }

    .principles li { grid-template-columns: 3rem 1fr; gap: 1rem; }
    .p-num { font-size: 1.7rem; }

    .timeline li { grid-template-columns: 1fr; gap: 0.4rem; }

    .case-list article > a,
    .case-empty { grid-template-columns: 1fr; }

    .snapshot { grid-template-columns: repeat(2, 1fr); }
    .outcomes { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ============================================================
   PALETTE ALTERNATIVES
   ------------------------------------------------------------
   Try a different mood by uncommenting ONE of the blocks below.
   Each overrides the relevant variables from :root above.
   You can also drop one of these into the <head> of a single
   page (inside a <style> tag) to preview just that page.
   ============================================================ */

/* --- A · Terracotta on ink — warmer, Portuguese rooftop ---
:root {
    --azulejo:       #d27a55;
    --azulejo-deep:  #a14d2c;
    --azulejo-pale:  rgba(210, 122, 85, 0.10);
    --azulejo-glow:  rgba(210, 122, 85, 0.20);
    --terracotta:    #5b8ed3;
}
*/

/* --- B · Sage / eucalyptus — calmer, healthcare-feeling ---
:root {
    --azulejo:       #8fb588;
    --azulejo-deep:  #4f7a4a;
    --azulejo-pale:  rgba(143, 181, 136, 0.10);
    --azulejo-glow:  rgba(143, 181, 136, 0.18);
    --terracotta:    #d27a55;
}
*/

/* --- C · Bone-light reverse (parchment + ink, terracotta accent) ---
   Bigger swap: this flips dark→light. Use as a separate stylesheet
   if you want both modes, or replace :root entirely.
:root {
    --bg:           #f3eee2;
    --bg-elev:      #ece6d6;
    --bg-card:      #ffffff;
    --ink:          #1a1c22;
    --ink-muted:    #6a6c75;
    --ink-faded:    #989aa3;
    --rule:         rgba(26, 28, 34, 0.10);
    --rule-strong:  rgba(26, 28, 34, 0.18);
    --azulejo:      #b3552c;
    --azulejo-deep: #8a3e1d;
    --azulejo-pale: rgba(179, 85, 44, 0.10);
    --azulejo-glow: rgba(179, 85, 44, 0.18);
}
body::after { display: none; }
*/

/* ============================================================
   EXPERIENCE LAYER
   ------------------------------------------------------------
   Cursor, kinetic type, mosaic, marquee, grain, transitions.
   Everything here is progressive enhancement: pages render
   fine without JS, and prefers-reduced-motion turns it off.
   ============================================================ */

/* ---------- Page transitions ---------- */
html.js body { animation: page-in 0.7s ease both; }
html.page-leave body { opacity: 0; transition: opacity 0.24s ease; }

@keyframes page-in {
    from { opacity: 0; }
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 210;
    background: linear-gradient(90deg, var(--azulejo), var(--terracotta));
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
}

.nav.scrolled {
    background: rgba(13, 15, 20, 0.92);
    box-shadow: 0 14px 44px -22px rgba(0, 0, 0, 0.65);
}

/* ---------- Film grain ---------- */
.grain {
    position: fixed;
    inset: -100px;
    z-index: 240;
    pointer-events: none;
    opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain-shift 1.4s steps(7) infinite;
}

@keyframes grain-shift {
    0%   { transform: translate(0, 0); }
    20%  { transform: translate(-28px, 16px); }
    40%  { transform: translate(18px, -30px); }
    60%  { transform: translate(-12px, -22px); }
    80%  { transform: translate(26px, 24px); }
    100% { transform: translate(0, 0); }
}

/* ---------- Custom cursor ---------- */
html.has-cursor * { cursor: none !important; }

.cursor-dot,
.cursor-ring {
    position: fixed;
    left: 0;
    top: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cursor-dot { z-index: 302; }
.cursor-ring { z-index: 301; }

html.cursor-vis .cursor-dot,
html.cursor-vis .cursor-ring { opacity: 1; }

.cursor-dot::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--azulejo);
}

.cursor-ring-i {
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 1px solid var(--azulejo);
    border-radius: 50%;
    opacity: 0.45;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.3s ease, background 0.3s ease;
}

html.cursor-link .cursor-ring-i {
    transform: scale(1.5);
    opacity: 0.9;
    background: var(--azulejo-pale);
}

html.cursor-down .cursor-ring-i { transform: scale(0.72); }

/* ---------- Kinetic headlines ---------- */
.split-words .w { display: inline-block; }

.split-words .wi {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.55em) rotate(1.5deg);
    filter: blur(7px);
    transition:
        opacity 0.65s ease,
        transform 0.85s cubic-bezier(0.16, 0.7, 0.2, 1),
        filter 0.65s ease;
    transition-delay: calc(var(--i, 0) * 55ms);
}

.split-words.in .wi {
    opacity: 1;
    transform: none;
    filter: none;
}

/* ---------- CTA spotlight (pillars get theirs above) ---------- */
.kicker-cta {
    position: relative;
    overflow: hidden;
}

.kicker-cta::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), var(--azulejo-glow), transparent 70%);
    transition: opacity 0.35s ease;
}

.kicker-cta:hover::after { opacity: 1; }

/* ---------- Living azulejo mosaic ---------- */
.hero-visual { position: relative; }

.mosaic {
    display: grid;
    gap: 6px;
    aspect-ratio: 1 / 1;
    padding: clamp(0.75rem, 2vw, 1.25rem);
    border: 1px solid var(--rule);
    background: linear-gradient(160deg, var(--azulejo-pale), transparent 65%);
}

.mosaic span {
    color: var(--azulejo);
    opacity: 0.15;
    transition: opacity 0.5s linear, transform 0.55s ease;
    will-change: opacity, transform;
}

.mosaic svg {
    width: 100%;
    height: 100%;
}

.mosaic-caption {
    margin-top: 1rem;
    color: var(--ink-faded);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.mosaic-caption::before {
    content: '';
    width: 1.5rem;
    height: 1px;
    background: var(--rule-strong);
}

@media (max-width: 960px) {
    .mosaic { aspect-ratio: 2 / 1; }
}

/* ---------- Marquee ---------- */
.marquee {
    position: relative;
    z-index: 1;
    overflow: hidden;
    border-block: 1px solid var(--rule);
    padding-block: 1.35rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee-scroll 32s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-group {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding-right: 3rem;
    white-space: nowrap;
}

.marquee-group span {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    color: var(--ink-muted);
}

.marquee-group .m-dot {
    color: var(--azulejo);
    font-size: 0.7rem;
    font-style: normal;
}

@keyframes marquee-scroll {
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    html.js .reveal { opacity: 1; transform: none; }
    .split-words .wi { opacity: 1; transform: none; filter: none; }
    .marquee-track { animation: none; }
    .grain, .cursor-dot, .cursor-ring { display: none; }
}
