:root {
  color-scheme: dark;
  --bg: #140808;
  --band: #1d0e0e;
  --panel: #2a1616;
  --panel-2: #382121;
  --block: #4b1b1b;
  --surface: rgba(255, 255, 255, .08);
  --surface-strong: rgba(255, 255, 255, .14);
  --menu-bg: #2a1616;
  --text: #f6efec;
  --muted: #c3b1ac;
  --line: rgba(255, 255, 255, .1);
  --accent: #ff7468;
  --red: #b50f0f;
  --red-hover: #cb1515;
  --btn-bg: #f6efec;
  --btn-fg: #1a0707;
  --display: 'Archivo', 'Arial Black', system-ui, sans-serif;
  --head: 'Familjen Grotesk', 'Segoe UI', system-ui, sans-serif;
  --body: 'Newsreader', Georgia, 'Times New Roman', serif;
  --ui: 'Familjen Grotesk', 'Segoe UI', system-ui, sans-serif;
  --tr: .2;
  --body-size: 1.2rem;
  --max: 1120px;
  --radius: 14px;
  --radius-sm: 8px;
  --sheet-overlap: 56px;
}

[data-theme='light'] {
  color-scheme: light;
  --bg: #f8f2ef;
  --band: #f0e6e2;
  --panel: #e6d9d4;
  --panel-2: #dccdc7;
  --block: #e0c3bb;
  --surface: rgba(60, 15, 15, .07);
  --surface-strong: rgba(60, 15, 15, .12);
  --menu-bg: #e6d9d4;
  --text: #2a0d0d;
  --muted: #5e4946;
  --line: rgba(60, 15, 15, .13);
  --accent: #a31212;
  --btn-bg: #2a0d0d;
  --btn-fg: #f8f2ef;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--body-size)/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--head); font-weight: 600; line-height: 1.1; letter-spacing: calc(-.02em * var(--tr)); }
.brand-name, .main-nav a, .nav-contact, .btn, .row-num, .row-meta, .project-meta, .browser-url, .chips li, .tag, .when, .where, .provider, .hub, .site, .facts dt, .diagram-hint, .site-footer, .icon-button { font-family: var(--ui); }
p { margin: 0 0 1em; }
dl, dd { margin: 0; }
.container { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }

/* Header */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  color: #fff;
  transition: background .3s, color .3s;
}
.site-header.is-scrolled {
  color: var(--text);
  background: var(--bg);
}
.header-inner {
  height: 80px;
  padding: 0 clamp(20px, 5.4vw, 80px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; justify-self: start; text-decoration: none; }
.brand-avatar {
  width: 40px; height: 40px;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: #5a2222;
}
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 1.1rem; font-weight: 500; letter-spacing: -.01em; }
.main-nav { display: flex; gap: 28px; }
.main-nav a { font-size: 1rem; font-weight: 500; text-decoration: none; opacity: .85; transition: opacity .2s; }
.main-nav a:hover, .main-nav a:focus-visible { opacity: 1; }
.nav-contact-mobile { display: none; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.nav-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  color: #1a0707;
  background: #f6efec;
  border-radius: var(--radius-sm);
  font-size: .98rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .2s, background .3s, color .3s;
}
.site-header.is-scrolled .nav-contact { color: var(--btn-fg); background: var(--btn-bg); }
.nav-contact:hover, .nav-contact:focus-visible { opacity: .88; }
.icon-button {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: inherit;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s;
}
.site-header.is-scrolled .icon-button { background: var(--panel); }
.icon-button:hover, .icon-button:focus-visible { background: var(--surface-strong); }
.theme-icon { font-size: 1rem; line-height: 1; }
.menu-toggle { display: none; }

/* Hero */
.hero { position: relative; }
.hero-panel {
  position: relative;
  height: min(100svh, 940px);
  min-height: 640px;
  overflow-x: clip;
  color: #fff;
  background:
    radial-gradient(ellipse 62% 50% at 50% 24%, rgba(125, 52, 52, .85) 0%, rgba(95, 34, 34, .5) 45%, transparent 78%),
    linear-gradient(180deg, #3b1111 0%, #240808 48%, #190505 100%);
}
.hero-mark { position: absolute; top: 25%; width: 210px; height: 210px; transform: translateY(-50%); pointer-events: none; }
.hero-mark-left { left: calc(8% - 105px); }
.hero-mark-right { right: calc(8% - 105px); }
.hero-mark::before, .hero-mark::after { content: ''; position: absolute; }
.hero-mark::before { left: 50%; top: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .55), transparent); }
.hero-mark::after { top: 50%; left: 0; right: 0; height: 1px; background: linear-gradient(to right, transparent, rgba(255, 255, 255, .55), transparent); }

.hero-title { position: absolute; top: 20%; left: 0; right: 0; z-index: 1; text-align: center; }
.hero-kicker {
  display: block;
  margin-bottom: .55em;
  font: 600 clamp(.95rem, 2.6vw, 2.8rem)/1 var(--display);
  letter-spacing: .24em;
  text-indent: .24em;
  text-transform: uppercase;
}
.hero-word {
  position: relative;
  display: inline-block;
  font: 800 clamp(3.6rem, 14vw, 15rem)/.8 var(--display);
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.hero-word::before, .hero-word::after { content: ''; position: absolute; left: -7%; right: -7%; pointer-events: none; }
.hero-word::before {
  z-index: -1;
  bottom: -.16em;
  height: .62em;
  background: linear-gradient(to top, rgba(255, 255, 255, .5), rgba(255, 255, 255, .12) 45%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
}
.hero-word::after {
  bottom: -.16em;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, .95) 12%, rgba(255, 255, 255, .95) 88%, transparent);
}

.hero-photo {
  position: absolute;
  z-index: 2;
  top: 31%;
  left: 50%;
  height: calc(69% + 24px);
  width: auto;
  max-width: none;
  transform: translateX(-50%);
}
.hero-intro {
  position: absolute;
  z-index: 3;
  left: clamp(24px, 5.4vw, 80px);
  bottom: calc(var(--sheet-overlap) + 36px);
  max-width: clamp(230px, 25vw, 380px);
}
.hero-lead { margin: 0 0 14px; font-family: var(--head); font-size: clamp(1.5rem, 2.4vw, 2.2rem); font-weight: 500; line-height: 1.12; letter-spacing: calc(-.025em * var(--tr)); }
.hero-copy { margin: 0; color: rgba(255, 255, 255, .78); font-size: 1.1rem; line-height: 1.5; }
.hero-cta {
  position: absolute;
  z-index: 3;
  right: clamp(24px, 6vw, 90px);
  bottom: calc(var(--sheet-overlap) + 40px);
  display: grid;
  gap: 12px;
  width: 224px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s;
}
.btn-red { background: var(--red); }
.btn-red:hover, .btn-red:focus-visible { background: var(--red-hover); }
.btn-glass {
  background: rgba(14, 5, 5, .62);
}
.btn-glass:hover, .btn-glass:focus-visible { background: rgba(14, 5, 5, .8); }

#about {
  position: relative;
  z-index: 3;
  margin-top: calc(-1 * var(--sheet-overlap));
  background: var(--bg);
  border-radius: 28px 28px 0 0;
}

/* Sections */
.section { padding: 120px 0; }
.section--tight { padding: 72px 0 96px; }
.section--roomy { padding: 152px 0 144px; }
.band { background: var(--band); }
.section h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); letter-spacing: calc(-.03em * var(--tr)); margin-bottom: 24px; }
.section h3 { font-size: 1.25rem; }

.about-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 72px; align-items: center; }
.about-copy p { max-width: 62ch; color: var(--muted); }
.about-copy .lede { color: var(--text); font-family: var(--head); font-size: 1.4rem; font-weight: 500; line-height: 1.4; letter-spacing: calc(-.015em * var(--tr)); }
.about-details { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; margin-top: 48px; }
.about-details h3 { margin-bottom: 14px; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 5px 13px;
  font-size: .92rem;
  background: var(--panel);
  border-radius: var(--radius-sm);
}
.about-photo {
  margin: 0;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--block);
}
.about-photo img { height: 92%; width: auto; }

/* Work */
.section-head { max-width: 760px; }
.section-head p:last-child { color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 16px 56px; margin: 40px 0 48px; }
.facts dt { color: var(--muted); font-size: .92rem; }
.facts dd { font-family: var(--head); font-size: 1.3rem; font-weight: 600; letter-spacing: calc(-.02em * var(--tr)); }

.diagram-card {
  padding: 28px 32px;
  background: var(--panel);
  border-radius: var(--radius);
}
.diagram-hint { color: var(--muted); font-size: .95rem; }
.diagram { display: grid; grid-template-columns: 200px minmax(60px, 1fr) 150px 48px 160px; grid-template-rows: 240px; align-items: center; margin: 8px 0 20px; }
.provider-stack { height: 100%; display: grid; grid-template-rows: repeat(3, 1fr); }
.provider-stack > div { display: flex; align-items: center; }
.provider {
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  color: var(--text);
  background: var(--panel-2);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.provider strong, .provider small { display: block; }
.provider strong { font-weight: 600; }
.provider small { color: var(--muted); font-size: .85rem; }
.provider:hover { background: color-mix(in srgb, var(--panel-2) 80%, var(--text)); }
.provider.is-selected { color: var(--bg); background: var(--text); }
.provider.is-selected small { color: var(--bg); opacity: .7; }
.routes { width: 100%; height: 100%; overflow: visible; }
.route { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; transition: stroke .25s; }
.route.is-active { stroke: var(--accent); stroke-width: 2; stroke-dasharray: none; }
.hub, .site { padding: 18px 14px; text-align: center; border-radius: var(--radius-sm); }
.hub { color: #fff; background: var(--red); }
.hub small { opacity: .85; }
.site { background: var(--panel-2); }
.hub strong, .hub small, .site strong, .site small { display: block; }
.hub strong, .site strong { font-weight: 600; }
.site small { color: var(--muted); font-size: .85rem; }
.connector { height: 2px; background: var(--accent); }
.diagram-detail { margin: 0; padding-top: 8px; color: var(--muted); }
.diagram-detail strong { color: var(--text); font-weight: 600; }

.work-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 56px; }
.work-notes h3 { margin-bottom: 10px; }
.work-notes p { color: var(--muted); }
.work-notes strong { color: var(--text); font-weight: 600; }

/* Projects */
.project { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.project-visual { position: relative; display: block; padding-bottom: 36px; text-decoration: none; }
.browser {
  display: block;
  overflow: hidden;
  background: var(--panel);
  border-radius: var(--radius);
}
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--panel-2); }
.browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .45; }
.browser-url { margin-left: 12px; padding: 2px 12px; color: var(--muted); background: var(--panel); border-radius: 6px; font-size: .78rem; }
.browser > img { width: 100%; height: auto; }
.phone {
  position: absolute;
  right: -14px;
  bottom: 0;
  width: 23%;
  height: auto;
  border: 4px solid #1b0a0a;
  border-radius: 22px;
  transition: transform .35s ease;
}
.project-visual:hover .phone { transform: translateY(-8px); }
.project-meta { margin-bottom: 12px; color: var(--muted); font-size: .92rem; font-weight: 500; }
.section .case-head h3 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.08; letter-spacing: calc(-.03em * var(--tr)); }
.project-info p { color: var(--muted); }
.project-info .project-stack { margin-bottom: 24px; font-size: 1rem; }
.case-head { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: end; }
.case-head > p { margin: 0; color: var(--muted); }


/* Work index */
.index { margin: 56px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.row { position: relative; border-bottom: 1px solid var(--line); }
.row-h { margin: 0; font-size: inherit; letter-spacing: inherit; }
.row-head {
  width: 100%;
  display: grid;
  grid-template-columns: 64px 1fr auto 40px;
  align-items: center;
  gap: 16px;
  padding: 26px 0;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.row-num { color: var(--muted); font-size: .95rem; }
.row-title { font-family: var(--head); font-size: clamp(2rem, 5vw, 4.2rem); font-weight: 600; letter-spacing: calc(-.04em * var(--tr)); line-height: 1.02; opacity: .55; transition: transform .3s, opacity .3s; }
.row:hover .row-title, .row.is-open .row-title, .row-head:focus-visible .row-title { opacity: 1; transform: translateX(10px); }
.row-meta { color: var(--muted); font-size: .95rem; text-align: right; }
.row-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--text); background: var(--panel-2); border-radius: var(--radius-sm); font-size: 1.3rem; line-height: 1; transition: transform .3s, background .3s, color .3s; }
.row.is-open .row-icon { transform: rotate(45deg); color: var(--bg); background: var(--text); }
.row-body { display: grid; grid-template-rows: 1fr; }
.js .row-body { grid-template-rows: 0fr; transition: grid-template-rows .45s ease; }
.js .row.is-open .row-body { grid-template-rows: 1fr; }
.row-body > div { overflow: hidden; }
.row-inner { padding: 8px 0 56px 80px; }
.row-peek { display: none; }
@media (hover: hover) and (min-width: 901px) {
  .row-peek { display: block; position: absolute; right: 250px; top: -22px; z-index: 3; width: 200px; height: auto; border-radius: 10px; opacity: 0; transform: rotate(-4deg) translateY(12px); transition: opacity .3s, transform .3s; pointer-events: none; }
  .row:not(.is-open):hover .row-peek { opacity: 1; transform: rotate(-4deg); }
}

/* Building */
.building-layout { display: grid; grid-template-columns: 1fr 1.3fr; gap: 64px; align-items: start; }
.note-card {
  padding: 30px 32px;
  background: var(--panel);
  border-radius: var(--radius);
}
.note-card h3 { margin: 16px 0 10px; font-size: 1.45rem; }
.note-card p { margin: 0; color: var(--muted); }
.tag { display: inline-block; padding: 2px 12px; color: var(--text); background: var(--panel-2); border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; }

/* Experience */
.experience-layout { display: grid; grid-template-columns: 1fr 2.2fr; gap: 64px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 24px; padding: 0 0 44px; }
.timeline li:last-child { padding-bottom: 0; }
.when { color: var(--muted); font-size: .95rem; padding-top: 4px; }
.where { margin: 4px 0 10px; color: var(--text); font-size: .98rem; font-weight: 500; }
.timeline p:last-child { margin: 0; color: var(--muted); }
.sub-heading { margin: 48px 0 16px; }
.education {
  display: grid;
  padding: 20px 24px;
  background: var(--panel);
  border-radius: var(--radius);
}
.education strong { font-weight: 600; }
.education span { color: var(--muted); }

/* Contact */
.contact-layout { max-width: 680px; text-align: center; }
.contact-layout h2 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
.contact-layout > p { color: var(--muted); }
.btn-large { margin: 16px 0 24px; padding: 15px 28px; font-size: 1.1rem; overflow-wrap: anywhere; }
.contact-alt a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.site-footer { padding: 28px 0; background: var(--band); color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (max-width: 900px) {
  .header-inner { grid-template-columns: 1fr auto; height: 68px; }
  .nav-contact { display: none; }
  .nav-contact-mobile { display: block; }
  .main-nav {
    position: absolute; top: 68px; left: 16px; right: 16px;
    display: grid; gap: 0;
    max-height: 0; overflow: hidden;
    padding: 0 18px;
    color: var(--text);
    background: var(--menu-bg);
    border-radius: var(--radius);
    transition: max-height .3s, padding .3s;
  }
  .main-nav.is-open { max-height: 300px; padding: 8px 18px; }
  .main-nav a { padding: 13px 0; opacity: 1; }
  .menu-toggle { display: grid; }
  .header-actions { gap: 8px; }

  .hero-panel {
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 108px 24px calc(var(--sheet-overlap) + 32px);
  }
  .hero-mark { display: none; }
  .hero-title { position: relative; top: auto; left: auto; right: auto; }
  .hero-kicker { font-size: clamp(.8rem, 3.4vw, 1.6rem); }
  .hero-word { font-size: clamp(3.4rem, 15.5vw, 9.5rem); }
  .hero-photo {
    position: relative;
    top: auto; left: auto;
    transform: none;
    width: min(340px, 80%);
    height: auto;
    margin-top: -7vw;
    -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  }
  .hero-intro { position: relative; left: auto; bottom: auto; max-width: 520px; width: 100%; margin-top: -28px; }
  .hero-cta { position: relative; right: auto; bottom: auto; display: flex; flex-wrap: wrap; width: 100%; max-width: 520px; margin-top: 28px; }
  .hero-cta .btn { flex: 1 1 200px; }

  .about-layout, .building-layout, .experience-layout, .project, .case-head { grid-template-columns: 1fr; gap: 32px; }
  .row-head { grid-template-columns: 32px 1fr 36px; gap: 12px; }
  .row-meta { display: none; }
  .row-inner { padding-left: 0; }
  .project-visual { max-width: 640px; }
  .about-photo { max-width: 360px; grid-row: 1; }
  .work-notes { grid-template-columns: 1fr; gap: 28px; }
  .diagram { grid-template-columns: 1fr; grid-template-rows: none; gap: 0; justify-items: center; }
  .provider-stack { width: 100%; height: auto; grid-template-rows: none; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .provider { text-align: center; padding: 10px 8px; }
  .provider small { display: none; }
  .routes { display: none; }
  .connector { width: 2px; height: 28px; }
  .hub { margin-top: 28px; position: relative; }
  .hub::before { content: ''; position: absolute; left: 50%; top: -28px; width: 2px; height: 28px; background: var(--accent); }
  .hub, .site { width: min(240px, 100%); }
}

@media (max-width: 760px) {
  :root { --sheet-overlap: 36px; }
  .container { width: calc(100% - 32px); }
  #about { border-radius: 22px 22px 0 0; }
  .section { padding: 84px 0; }
  .about-details { grid-template-columns: 1fr; }
  .phone { right: -6px; width: 26%; border-width: 3px; border-radius: 16px; }
  .facts { gap: 16px 32px; }
  .diagram-card, .note-card { padding: 22px 20px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
