/* ============================================================
   MATTS W. JOHANSSON — PORTFOLIO STYLESHEET
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ============================================================
   RESET & CUSTOM PROPERTIES
   ============================================================ */

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

:root {
  --cream:      #f0ebe1;
  --dark:       #1a1a1a;
  --mid:        #4a4a4a;
  --light-mid:  #6a6a6a;
  --accent:     #c1272d;   /* matches the logo red — adjust if needed */
  --mono:       'Space Mono', 'JetBrains Mono', 'Courier New', monospace;
  --sans:       'Helvetica Neue', Helvetica, Arial, sans-serif;

  --nav-h:      68px;
  --max-w:      860px;    /* narrower so text feels centred */
  --side-pad:   40px;
}

@media (max-width: 768px) {
  :root {
    --nav-h:    56px;
    --side-pad: 20px;
  }
}

html {
  scroll-behavior: smooth;
  color-scheme: only light;   /* prevents browser dark-mode inversion */
}

/* Force light colours even when OS dark mode is active */
@media (prefers-color-scheme: dark) {
  html, body {
    background: #f0ebe1 !important;
    color: #1a1a1a !important;
  }
  .nav {
    background: #f0ebe1 !important;
    border-color: #1a1a1a !important;
  }
  .nav-links a, .nav-logo { color: #1a1a1a !important; }
  .section--dark { background: #1a1a1a !important; }
  .section--accent { background: #c1272d !important; }
  .footer { background: #1a1a1a !important; }
  .divider { border-color: #1a1a1a !important; }
}

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.is-loaded {
  opacity: 1;
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-h);
  z-index: 200;
  background: var(--cream);
  border-bottom: 2px solid var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--side-pad);
}

.nav--scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

/* LOGO — always visible, top-left, no white bg via multiply blend */
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-logo img {
  height: 40px;
  width: auto;
  mix-blend-mode: multiply;   /* removes white background from PNG */
  display: block;
}

/* fallback circle if image not yet placed */
.nav-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logo-fallback span {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

/* Desktop nav links */
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--dark);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-links a:hover::after {
  width: 100%;
}

/* HAMBURGER — mobile only */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 210;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--dark);
  border-radius: 1px;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

/* Hamburger → X when open */
.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav drawer */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--cream);
    border-bottom: 2px solid var(--dark);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
  }

  .nav-links.open {
    max-height: 480px;
    padding: 16px 0 24px;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 12px var(--side-pad);
    font-size: 12px;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */

.container {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--side-pad);
  padding-right: var(--side-pad);
}

.section {
  padding: 80px 0;
}

.section--dark {
  background: var(--dark);
  color: var(--cream);
}

.section--accent {
  background: var(--accent);
  color: #fff;
}

.divider {
  border: none;
  border-top: 2px solid var(--dark);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--accent);
}

.section--dark .label {
  color: var(--accent);    /* red stays red on dark backgrounds */
}

.display-title {
  font-family: var(--mono);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -1.5px;
  color: var(--dark);
}

.section--dark .display-title {
  color: var(--cream);
}

.body-text {
  font-size: 17px;
  line-height: 1.72;
  color: var(--mid);
}

.body-text p + p {
  margin-top: 20px;
}

.body-text strong {
  color: var(--dark);
  font-weight: 600;
}

.section--dark .body-text {
  color: #a8a39b;
}

.section--dark .body-text strong {
  color: var(--cream);
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  padding-top: calc(var(--nav-h) + 80px);
  padding-bottom: 80px;
}

.hero__tag {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-bottom: 28px;
}

.hero__tag span {
  display: inline;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .hero__tag span {
    display: block;   /* each pair goes on its own line → 2 rows × 2 titles */
  }
}

.hero__title {
  font-size: clamp(48px, 10vw, 120px);
  margin-bottom: 52px;
}

.hero__statement {
  font-family: var(--mono);
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  line-height: 1.4;
  color: var(--dark);
  max-width: 680px;
  margin-bottom: 48px;
}

.hero__body {
  max-width: 640px;
  font-family: var(--mono);  /* typewriter feel in hero */
  font-size: 15px;
  line-height: 1.8;
}

.hero__body strong {
  font-weight: 700;
  color: var(--dark);
}

/* ============================================================
   HERO CTA (inline contact)
   ============================================================ */

.hero__cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 0;
  margin-top: 48px;
  margin-bottom: 4px;
}

.hero__contact-link {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.2s;
}

.hero__contact-link:hover {
  color: var(--accent);
}

.hero__contact-sep {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--light-mid);
}

.hero__contact-phone {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--mid);
}

/* ============================================================
   PULL QUOTE
   ============================================================ */

.pull-quote {
  border-left: 4px solid var(--accent);
  padding: 8px 0 8px 28px;
  margin: 52px 0;
  max-width: 600px;
}

.pull-quote p {
  font-family: var(--mono);
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.6;
  color: var(--dark);
  font-style: italic;
}

.pull-quote__attr {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-top: 12px;
}

/* ============================================================
   PORTRAIT SECTION
   ============================================================ */

.portrait-section {
  padding: 0;
  overflow: hidden;
}

.portrait-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
}

.portrait-image {
  overflow: hidden;
}

.portrait-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  filter: grayscale(15%);
}

.portrait-text {
  background: var(--dark);
  padding: 72px var(--side-pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.portrait-text .quote-text {
  font-family: var(--mono);
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--cream);
  margin-bottom: 28px;
  letter-spacing: -0.5px;
}

.portrait-text .quote-caption {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #6a655d;
}

@media (max-width: 700px) {
  .portrait-inner {
    grid-template-columns: 1fr;
  }
  .portrait-image {
    height: 360px;
  }
  .portrait-text {
    padding: 48px var(--side-pad);
  }
}

/* When portrait.jpg is missing — collapse to quote-only panel */
.portrait-inner.portrait--no-image {
  grid-template-columns: 1fr;
}

.portrait-inner.portrait--no-image .portrait-image {
  display: none;
}

.portrait-inner.portrait--no-image .portrait-text {
  padding: 72px var(--side-pad);
  max-width: 640px;
}

/* ============================================================
   TIMELINE
   ============================================================ */

.timeline {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 0 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--dark);
  transform: translateX(-50%);
}

.tl-entry {
  position: relative;
  width: 50%;
  padding: 0 44px 52px;
}

.tl-left {
  left: 0;
  text-align: right;
  padding-left: 0;
}

.tl-right {
  left: 50%;
  text-align: left;
  padding-right: 0;
}

.tl-entry::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
}

.tl-left::after  { right: -6px; }
.tl-right::after { left:  -6px; }

.tl-year {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.tl-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tl-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--light-mid);
}

.tl-entry--highlight .tl-title {
  color: var(--accent);
}

@media (max-width: 680px) {
  .timeline::before { left: 14px; }

  .tl-entry,
  .tl-left,
  .tl-right {
    width: 100%;
    left: 0;
    text-align: left;
    padding: 0 0 36px 40px;
  }

  .tl-left::after,
  .tl-right::after {
    left: 8px;
    right: auto;
  }
}

/* ============================================================
   QUOTES (dark section)
   ============================================================ */

.quote-block {
  padding: 44px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.quote-block:first-of-type {
  padding-top: 0;
}

.quote-block:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.quote-block__text {
  font-family: var(--mono);
  font-size: clamp(18px, 2.8vw, 28px);
  font-weight: 400;
  line-height: 1.35;
  color: var(--cream);
  font-style: italic;
  margin-bottom: 14px;
}

.quote-block__attr {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #6a655d;
}

/* ============================================================
   PRESS ROW
   ============================================================ */

.press-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  align-items: center;
  justify-content: center;
  margin-top: 36px;
}

.press-name {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #8a857d;
}

/* ============================================================
   ADVISORY SECTION
   ============================================================ */

.adv-title {
  font-size: clamp(40px, 8vw, 96px);
  margin-bottom: 44px;
  letter-spacing: -2px;
}

.adv-lead {
  max-width: 700px;
  margin-bottom: 64px;
}

.adv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px 60px;
}

@media (max-width: 680px) {
  .adv-grid { grid-template-columns: 1fr; gap: 40px; }
}

.adv-item {
  border-top: 2px solid var(--dark);
  padding-top: 20px;
}

.adv-item h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--dark);
  margin-bottom: 14px;
}

.adv-item p {
  font-size: 15px;
  line-height: 1.68;
  color: var(--mid);
}

/* ============================================================
   COMING SOON PLACEHOLDER
   ============================================================ */

.coming-soon {
  padding: 72px 0;
  text-align: center;
}

.coming-soon__icon {
  font-family: var(--mono);
  font-size: 44px;
  color: var(--accent);
  margin-bottom: 20px;
  display: block;
}

.coming-soon__title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--dark);
  margin-bottom: 12px;
}

.coming-soon__desc {
  font-size: 15px;
  color: var(--light-mid);
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============================================================
   CTA SECTION
   ============================================================ */

.cta {
  text-align: center;
}

.cta h2 {
  font-family: var(--mono);
  font-size: clamp(24px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -1px;
  color: #fff;
  margin-bottom: 20px;
}

.cta p {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255,255,255,0.88);
  max-width: 500px;
  margin: 0 auto 36px;
}

.cta-email {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  border: 2px solid #fff;
  padding: 14px 38px;
  display: inline-block;
  transition: background 0.2s, color 0.2s;
}

.cta-email:hover {
  background: #fff;
  color: var(--accent);
}

.cta-phone {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.8);
  margin-top: 20px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  background: var(--dark);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 28px var(--side-pad);
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #55504a;
}

/* ============================================================
   UTILITY
   ============================================================ */

.mt-sm  { margin-top: 24px; }
.mt-md  { margin-top: 48px; }
.mt-lg  { margin-top: 72px; }

@media (max-width: 768px) {
  .section { padding: 60px 0; }
}

/* ============================================================
   SCROLL ANIMATIONS — fade-up
   ============================================================ */

.section,
.tl-entry,
.adv-item,
.quote-block {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.section.is-visible,
.tl-entry.is-visible,
.adv-item.is-visible,
.quote-block.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .section,
  .tl-entry,
  .adv-item,
  .quote-block {
    opacity: 1;
    transform: none;
    transition: none;
  }
  body {
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ============================================================
   TIMELINE DOT PULSE
   ============================================================ */

@keyframes pulse-once {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.tl-entry.is-visible::after {
  animation: pulse-once 0.6s ease-out forwards;
}

/* ============================================================
   PULL QUOTE — accent bar height animation
   ============================================================ */

.pull-quote {
  overflow: hidden;
}

.pull-quote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 0;
  background: var(--accent);
  transition: height 0.45s ease-out 0.15s;
}

/* The original border-left handles the visual; we use a wrapper trick instead.
   Override the static border and use a positioned pseudo-element for animation. */
.pull-quote {
  position: relative;
  border-left: none;
  padding-left: 28px;
}

/* Restore static bar for users with reduced motion or before JS runs */
@media (prefers-reduced-motion: reduce) {
  .pull-quote {
    border-left: 4px solid var(--accent);
  }
  .pull-quote::before {
    display: none;
  }
}

.pull-quote.is-visible::before {
  height: 100%;
}

/* ============================================================
   CTA EMAIL BUTTON — sliding fill on hover
   ============================================================ */

.cta-email {
  position: relative;
  overflow: hidden;
  /* Remove the instant transition — handled by ::before now */
  transition: color 0.28s ease;
}

.cta-email::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #fff;
  transition: left 0.28s ease;
  z-index: 0;
}

.cta-email:hover::before {
  left: 0;
}

.cta-email:hover {
  color: var(--accent);
  background: transparent;
}

/* Ensure text stays above the sliding fill */
.cta-email span,
.cta-email {
  position: relative;
  z-index: 1;
}
