/* ============================================================
   ScanArc — Design System
   Warm off-white / dark, auto dark mode, Cera Pro
   Type scale: display (light) · statement (light) · body (bold)
   ============================================================ */

/* Fonts */
@font-face {
    font-family: 'Cera Pro';
    src: url('/fonts/Cera-Pro-Light.woff2') format('woff2'),
         url('/fonts/Cera-Pro-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cera Pro';
    src: url('/fonts/Cera-Pro-Regular.woff2') format('woff2'),
         url('/fonts/Cera-Pro-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cera Pro';
    src: url('/fonts/Cera-Pro-Bold.woff2') format('woff2'),
         url('/fonts/Cera-Pro-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   Color tokens
   ============================================================ */
:root {
    --bg:        #F5F0EB;
    --text:      #1A1A18;
    --text-soft: #6A6A64;
    --border:    #D4CEC7;
    --font:      'Cera Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;

    /* Type scale */
    --size-display:   clamp(3.2rem, 8.5vw, 7.5rem);
    --size-statement: clamp(1.35rem, 2.5vw, 1.75rem);
    --size-body:      1.25rem;

    --max-width:    1200px;
    --page-padding: 3rem;
    --section-gap:  9rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #1A1A18;
        --text:      #F5F0EB;
        --text-soft: #9A9690;
        --border:    #2E2E2A;
    }
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-weight: 400;
    line-height: 1.6;
    overflow-x: clip; /* prevents horizontal scroll from full-bleed strip elements */
}

/* ============================================================
   Accessibility / SEO utilities
   ============================================================ */
.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;
}

/* ============================================================
   Layout
   ============================================================ */
.page-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--page-padding);
}

/* ============================================================
   Header & nav
   ============================================================ */
header {
    padding: 2rem 0;
}

header .page-wrap {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

/* ScanArc text mark */
.site-name {
    font-size: var(--size-body);
    font-weight: 400;
    letter-spacing: 0.14em;
    text-decoration: none;
    color: var(--text);
    display: block;
    line-height: 1;
}

a.site-name:hover {
    color: var(--text-soft);
    text-decoration: none;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 2.5rem;
    align-items: baseline;
}

nav ul li a {
    font-weight: 400;
    font-size: var(--size-body);
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--text-soft);
    transition: color 0.15s;
}

nav ul li a:hover {
    color: var(--text);
}

nav ul li a[aria-current="page"] {
    color: var(--text);
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}

/* Hamburger button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text);
    line-height: 0;
}

.nav-toggle .icon-close {
    display: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
    display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
    display: block;
}

/* ============================================================
   Main
   ============================================================ */
main {
    padding-top: 6rem;
    padding-bottom: 10rem;
}

/* ============================================================
   Typography — no italic, no uppercase
   ============================================================ */
h1 {
    font-weight: 300;
    font-size: var(--size-display);
    line-height: 1.0;
    letter-spacing: -0.03em;
    margin: 0 0 3rem;
    max-width: 14ch;
}

h2 {
    font-weight: 300;
    font-size: var(--size-statement);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 1.5rem;
    color: var(--text);
    max-width: 28ch;
}

h3 {
    font-weight: 400;
    font-size: var(--size-body);
    line-height: 1.5;
    letter-spacing: 0.02em;
    margin: 0 0 0.5rem;
    color: var(--text);
}

p {
    margin: 0 0 1.25em;
    font-weight: 400;
    font-size: var(--size-body);
    max-width: 62ch;
    line-height: 1.7;
}

strong {
    font-weight: 400;
}

em {
    font-style: normal;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    transition: text-decoration-color 0.15s;
}

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

small, .meta {
    font-size: var(--size-body);
    color: var(--text-soft);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--section-gap) 0;
}

/* ============================================================
   Homepage hero
   ============================================================ */
.hero {
    padding-bottom: var(--section-gap);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--section-gap);
}

.hero h1 {
    margin-bottom: 3rem;
}

.hero p {
    font-size: var(--size-body);
    font-weight: 400;
    line-height: 1.7;
    max-width: 52ch;
    color: var(--text);
}

.hero p + p {
    color: var(--text-soft);
}

/* ============================================================
   Homepage — full-screen SVG stage
   ============================================================ */
body.home {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg);
}

html:has(body.home) {
    height: 100%;
    overflow: hidden;
}

.home-stage {
    position: fixed;
    inset: 0;
    padding-top: 5.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG fills the stage and is always fully visible (letterbox/pillarbox) */
.home-stage svg {
    width: 100%;
    height: 100%;
    display: block;
    /* preserveAspectRatio="xMidYMid meet" is SVG default — keeps full drawing visible */
}

/* Strokes adapt to light/dark mode; fill removed for line-drawing effect */
.home-stage path,
.home-stage line,
.home-stage polyline,
.home-stage polygon,
.home-stage rect,
.home-stage circle,
.home-stage ellipse {
    stroke: var(--text) !important;
    fill: none !important;
    vector-effect: non-scaling-stroke;
}

/* Header overlays the SVG */
.home-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 2rem 0;
}

.home-header .page-wrap {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .home-header nav {
        background: var(--bg);
    }
}


/* ============================================================
   Inner page — full-width SVG strip
   Full-bleed: works whether the div is inside .page-wrap or not.
   Height is set dynamically by JS to match the SVG aspect ratio
   (capped at 60 vh), so the drawing is always shown in full.
   ============================================================ */
.page-svg-strip {
    /* Full-bleed breakout from the centred page-wrap */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    overflow: hidden;
    /* JS sets height; this is a visible fallback while the SVG loads */
    min-height: 2px;
}

.page-svg-strip svg {
    width: 100%;
    height: 100%;
    display: block;
}

.page-svg-strip path,
.page-svg-strip line,
.page-svg-strip polyline,
.page-svg-strip polygon,
.page-svg-strip rect,
.page-svg-strip circle,
.page-svg-strip ellipse {
    stroke: var(--text) !important;
    fill: none !important;
    vector-effect: non-scaling-stroke;
}

/* ============================================================
   CTA link
   ============================================================ */
.cta {
    display: inline-block;
    font-size: var(--size-body);
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--text);
    padding-bottom: 2px;
    transition: color 0.15s, border-color 0.15s;
}

.cta:hover {
    color: var(--text-soft);
    border-color: var(--text-soft);
    text-decoration: none;
}

/* ============================================================
   Process steps
   ============================================================ */
.process {
    list-style: none;
    padding: 0;
    margin: 2rem 0 3rem;
    counter-reset: step;
}

.process li {
    font-size: var(--size-body);
    font-weight: 400;
    color: var(--text-soft);
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 1.5rem;
    align-items: baseline;
    counter-increment: step;
}

.process li:first-child {
    border-top: 1px solid var(--border);
}

.process li::before {
    content: counter(step);
    font-size: var(--size-body);
    color: var(--text-soft);
    font-weight: 400;
}

/* ============================================================
   Leistungen statement section
   ============================================================ */
.statement-section {
    padding-top: var(--section-gap);
}

.statement-section h2 {
    margin-bottom: 3rem;
}

/* ============================================================
   Homepage project grid (index.md only)
   ============================================================ */
.projects-heading {
    font-size: var(--size-body);
    font-weight: 400;
    color: var(--text-soft);
    letter-spacing: 0.02em;
    margin: 0 0 2rem;
}

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

.project-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

.project-card a:hover img {
    opacity: 0.85;
}

.project-card-label {
    padding: 0.75rem 0 0;
}

.project-card h3 {
    font-size: var(--size-body);
    font-weight: 400;
    letter-spacing: 0;
    margin: 0 0 0.15rem;
    color: var(--text);
}

.project-card .project-meta {
    font-size: var(--size-body);
    color: var(--text-soft);
}

/* ============================================================
   Referenzen list (projekte/index.md)
   ============================================================ */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--size-body);
    margin-top: 3rem;
}

.reference-table thead th {
    text-align: left;
    padding: 0.5rem 2rem 0.75rem 0;
    font-weight: 400;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
}

.reference-table thead th:last-child {
    padding-right: 0;
}

.reference-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    position: relative;
}

.reference-table tbody tr:hover {
    background: color-mix(in srgb, var(--text) 3%, transparent);
}

.reference-table tbody td {
    padding: 1.1rem 2rem 1.1rem 0;
    vertical-align: top;
    font-weight: 400;
    color: var(--text-soft);
}

.reference-table tbody td:first-child {
    color: var(--text);
    padding-right: 2rem;
}

.reference-table tbody td:last-child {
    padding-right: 0;
}

.reference-table a {
    text-decoration: none;
    color: var(--text);
}

/* Stretched link — makes the whole row clickable */
.reference-table tbody td:first-child a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.reference-table tr:hover a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
}

/* ============================================================
   Back link (project pages)
   ============================================================ */
.back-link {
    display: inline-block;
    font-size: var(--size-body);
    color: var(--text-soft);
    text-decoration: none;
    margin-bottom: 3rem;
    letter-spacing: 0.01em;
    transition: color 0.15s;
}

.back-link:hover {
    color: var(--text);
    text-decoration: none;
}

/* ============================================================
   Project single page
   ============================================================ */
.project-header {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border);
}

.project-header h1 {
    font-size: var(--size-display);
    margin-bottom: 1.5rem;
    max-width: none;
}

.project-meta-block {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    font-size: var(--size-body);
    color: var(--text-soft);
}

.project-meta-block span {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.project-meta-block .label {
    color: var(--text-soft);
}

.project-meta-block .value {
    color: var(--text);
}

.project-images img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 0 3px;
    cursor: pointer;
}

.project-description {
    margin-top: 3rem;
    max-width: 62ch;
}

/* ============================================================
   Leistungen
   ============================================================ */
.leistungen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem var(--page-padding);
    margin: 4rem 0 5rem;
}

.leistung h3 {
    color: var(--text);
    margin-bottom: 1rem;
}

.leistung p {
    color: var(--text-soft);
    max-width: 34ch;
    margin: 0;
}

/* Detail levels table */

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--size-body);
}

.detail-table thead th {
    text-align: left;
    padding: 0.5rem 2rem 0.75rem 0;
    font-weight: 400;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
}

.detail-table tbody td {
    padding: 1.25rem 2rem 1.25rem 0;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
    color: var(--text-soft);
}

.detail-table tbody td:first-child {
    font-weight: 400;
    white-space: nowrap;
    color: var(--text);
    width: 5rem;
}

/* Two-column bottom section on Leistungen */
.leistungen-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem var(--page-padding);
    margin-top: 5rem;
}

.leistung-text h3 {
    margin-bottom: 1rem;
}

.leistung-text p {
    color: var(--text-soft);
    max-width: 44ch;
}

/* ============================================================
   Büro / team
   ============================================================ */
.team-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 5rem;
    align-items: start;
    margin-bottom: 2rem;
}

.profile-image {
    width: 100%;
    height: auto;
    display: block;
}

.team-text h2 {
    color: var(--text);
    margin-bottom: 1.5rem;
}

.team-text p {
    color: var(--text-soft);
}

.team-text p a {
    color: var(--text-soft);
    text-decoration-color: var(--border);
}

.team-text p a:hover {
    color: var(--text);
    text-decoration-color: var(--text);
}

/* ============================================================
   Kontakt
   ============================================================ */
.contact-block {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-block a {
    font-size: var(--size-body);
    color: var(--text);
    text-decoration: none;
    display: block;
}

.contact-block a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
}

.contact-block .address {
    color: var(--text-soft);
    font-style: normal;
    font-size: var(--size-body);
    font-weight: 400;
    line-height: 1.7;
}

/* ============================================================
   General images
   ============================================================ */
img {
    max-width: 100%;
    height: auto;
}

figure {
    margin: 2rem 0;
    padding: 0;
}

figcaption {
    font-size: var(--size-body);
    color: var(--text-soft);
    margin-top: 0.5rem;
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox .arrow,
.lightbox .close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 30, 30, 0.65);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    border: none;
    outline: none;
    user-select: none;
    transition: background 0.15s;
}

.lightbox .arrow:hover,
.lightbox .close:hover {
    background: rgba(30, 30, 30, 1);
}

.lightbox .arrow.left  { left: 2rem;  top: 50%; transform: translateY(-50%); }
.lightbox .arrow.right { right: 2rem; top: 50%; transform: translateY(-50%); }
.lightbox .close       { top: 2rem;   right: 2rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .leistungen-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .team-layout {
        grid-template-columns: 200px 1fr;
        gap: 3rem;
    }
}

@media (max-width: 900px) {
    /* Hide Year column on medium screens */
    .reference-table thead th:last-child,
    .reference-table tbody td:last-child {
        display: none;
    }

    .leistungen-bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --page-padding: 1.5rem;
        --section-gap:  5rem;
    }

    /* Collapse reference table to 2 visible columns */
    .reference-table thead th:nth-child(3),
    .reference-table tbody td:nth-child(3) {
        display: none;
    }

    /* Hide "Typischer Einsatz" column on mobile — keep Massstab + Inhalt */
    .detail-table thead th:nth-child(3),
    .detail-table tbody td:nth-child(3) {
        display: none;
    }

    .detail-table tbody td {
        padding: 1rem 1rem 1rem 0;
    }

    /* Mobile nav */
    .nav-toggle {
        display: block;
        position: relative;
        z-index: 102;
    }

    header nav {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg);
        padding: 5rem var(--page-padding) 2rem;
        z-index: 100;
        border-bottom: 1px solid var(--border);
    }

    header nav.is-open {
        display: block;
    }

    header {
        position: relative;
    }

    header .page-wrap {
        position: relative;
        z-index: 101;
    }

    nav ul {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-end;
        text-align: right;
    }

    nav ul li a {
        font-size: 1rem;
    }

    .leistungen-grid {
        grid-template-columns: 1fr;
    }

    .project-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2px;
    }

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

    .profile-image {
        max-width: 220px;
    }

    .lightbox .arrow { display: none; }

    .lightbox .close {
        top: 1rem;
        right: 1rem;
    }

    .project-meta-block {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
}

/* Portrait images: cap height on desktop so they don't overflow the screen.
   width: auto + max-width: 100% preserves aspect ratio and keeps landscape
   images at full container width (their natural size ≈ container width). */
@media (min-width: 769px) {
    .project-images img {
        max-height: 85vh;
        width: auto;
        max-width: 100%;
    }
}
