/* ============================================
   Mads Lindgaard — Portfolio
   Apple-inspired design system
   Light + dark themes via [data-theme] on <html>
   ============================================ */

/* ---------- Theme tokens: DARK (default) ---------- */

:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --surface: #111111;
  --nav-bg: rgba(0, 0, 0, 0.6);
  --nav-bg-scrolled: rgba(0, 0, 0, 0.8);

  --text: #f5f5f7;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --link-underline: rgba(255, 255, 255, 0.25);
  --link-underline-hover: #ffffff;

  --gradient-border: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(255, 255, 255, 0.02) 60%,
    rgba(255, 255, 255, 0.15) 100%
  );
  --gradient-border-hover: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.35) 100%
  );

  --media-sheen: rgba(255, 255, 255, 0.1);
  --figure-sheen: rgba(255, 255, 255, 0.08);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-bg-hover: rgba(255, 255, 255, 0.14);

  --selection-bg: rgba(255, 255, 255, 0.9);
  --selection-text: #000000;
  --card-shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.6);
}

/* ---------- Theme tokens: LIGHT ---------- */

[data-theme="light"] {
  color-scheme: light;

  --bg: #ffffff;
  --bg-elevated: #fbfbfd;
  --surface: #f5f5f7;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.88);

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --link-underline: rgba(0, 0, 0, 0.25);
  --link-underline-hover: #1d1d1f;

  --gradient-border: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.16) 0%,
    rgba(0, 0, 0, 0.05) 40%,
    rgba(0, 0, 0, 0.03) 60%,
    rgba(0, 0, 0, 0.1) 100%
  );
  --gradient-border-hover: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.34) 0%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.24) 100%
  );

  --media-sheen: rgba(0, 0, 0, 0.05);
  --figure-sheen: rgba(0, 0, 0, 0.04);
  --chip-bg: rgba(0, 0, 0, 0.06);
  --chip-bg-hover: rgba(0, 0, 0, 0.1);

  --selection-bg: rgba(0, 0, 0, 0.85);
  --selection-text: #ffffff;
  --card-shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.1);
}

/* ---------- Shared tokens ---------- */

:root {
  --radius: 24px;
  --ease-fluid: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-height: 52px;

  /* Brand well colors — identical in both themes */
  --brand-norlys: #f5f3eb;
  --brand-pluskort: #141416;
  --brand-secret: #1b2533;
  --brand-secret-top: #2a3646;
  --theme-fade: background-color 0.45s ease, color 0.45s ease,
    border-color 0.45s ease;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: "SF Pro Text", "SF Pro Display", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  overflow-x: hidden;
  transition: var(--theme-fade);
}

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

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.4s var(--ease-fluid), border-color 0.45s ease;
}

.nav.scrolled {
  background: var(--nav-bg-scrolled);
}

.nav-inner {
  width: 100%;
  max-width: 980px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.3s ease, color 0.45s ease;
  white-space: nowrap;
}

.nav-logo:hover {
  opacity: 0.7;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.3s ease, color 0.3s ease,
    transform 0.4s var(--ease-fluid), border-color 0.45s ease;
}

.theme-toggle:hover {
  background: var(--chip-bg-hover);
  color: var(--text);
  transform: scale(1.08);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the theme you'd switch TO */
.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

@media (max-width: 480px) {
  .nav-right {
    gap: 18px;
  }
  .nav-links {
    gap: 20px;
  }
}

/* ---------- Layout ---------- */

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  padding-top: var(--nav-height);
}

/* ---------- Hero ---------- */

.hero {
  padding: 96px 0 72px;
  text-align: center;
}

.hero h1 {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", sans-serif;
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.06;
  color: var(--text);
}

.hero p {
  margin-top: 16px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

/* ---------- Project grid ---------- */

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

/* Quiet closing note under the work grid */
.note {
  padding: 72px 0 140px;
  text-align: center;
}

.note p {
  font-size: 15px;
  color: var(--text-tertiary);
  letter-spacing: -0.01em;
}

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

/* ---------- Cards with gradient borders ---------- */

.card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1px; /* room for gradient border */
  text-decoration: none;
  color: inherit;
  transition: transform 0.6s var(--ease-fluid), box-shadow 0.6s var(--ease-fluid),
    background-color 0.45s ease;
  will-change: transform;
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.card::before {
  background: var(--gradient-border);
}

.card::after {
  background: var(--gradient-border-hover);
  opacity: 0;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--card-shadow-hover);
}

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

.card-media {
  aspect-ratio: 4 / 3;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background: radial-gradient(
      120% 120% at 20% 0%,
      var(--media-sheen) 0%,
      transparent 55%
    ),
    var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 0.45s ease;
}

.card-media span {
  font-size: 13px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.6s var(--ease-fluid), color 0.45s ease;
}

.card:hover .card-media span {
  transform: scale(1.06);
}

/* Solid brand-color media wells with a centered logo */
.card-media.brand-norlys,
.prose .figure.brand-norlys {
  background: var(--brand-norlys);
}

.card-media.brand-pluskort,
.prose .figure.brand-pluskort {
  background: var(--brand-pluskort);
}

/* Full-bleed photo wells */
.card-media.is-photo,
.prose .figure.is-photo {
  padding: 0;
  overflow: hidden;
}

.card-media.is-photo .photo,
.prose .figure.is-photo .photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s var(--ease-fluid);
}

.card:hover .card-media.is-photo .photo {
  transform: scale(1.04);
}

/* Keep the whole frame visible instead of cropping it */
.photo-contain {
  object-fit: contain !important;
}

/* Confidential project — solid deep slate with a subtle gradient */
.card-media.brand-secret,
.prose .figure.brand-secret {
  background: linear-gradient(
    160deg,
    var(--brand-secret-top) 0%,
    var(--brand-secret) 100%
  );
}

.brand-logo {
  width: 34%;
  max-width: 200px;
  height: auto;
  display: block;
  transition: transform 0.7s var(--ease-fluid);
}

.card:hover .brand-logo {
  transform: scale(1.05);
}

.prose .figure .brand-logo {
  width: 22%;
  max-width: 160px;
}

/* Placeholder cards for work not yet published */
.card.is-placeholder {
  cursor: default;
  opacity: 0.55;
}

.card.is-placeholder:hover {
  transform: none;
  box-shadow: none;
}

.card.is-placeholder:hover::after {
  opacity: 0;
}

.card.is-placeholder:hover .card-media span {
  transform: none;
}

.card-body {
  padding: 24px 28px 28px;
}

.card-body h3 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-body p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---------- Section headings ---------- */

.section-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

/* ---------- Detail / content pages ---------- */

.page-hero {
  padding: 120px 0 64px;
  max-width: 720px;
}

.page-hero h1 {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--text);
}

.page-hero .subtitle {
  margin-top: 16px;
  font-size: 21px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.meta-row {
  display: flex;
  gap: 48px;
  padding: 32px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 64px;
  flex-wrap: wrap;
}

.meta-item .meta-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.meta-item .meta-value {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text);
}

.prose {
  max-width: 720px;
  padding-bottom: 120px;
}

.prose h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 56px 0 16px;
}

.prose p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.prose .list {
  list-style: none;
  margin: 0 0 20px;
}

.prose .list li {
  position: relative;
  padding-left: 22px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prose .list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* Awards / recognitions list */
.prose .awards {
  list-style: none;
  margin-top: 4px;
}

.prose .award {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.45s ease;
}

.prose .award:first-child {
  border-top: 1px solid var(--border-subtle);
}

.prose .award-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.prose .award-meta {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.prose .award-result {
  flex: 0 0 auto;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .prose .award {
    flex-direction: column;
    gap: 8px;
  }
}

.prose .figure {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: radial-gradient(
      120% 120% at 80% 0%,
      var(--figure-sheen) 0%,
      transparent 55%
    ),
    var(--surface);
  border: 1px solid var(--border-subtle);
  margin: 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.45s ease, border-color 0.45s ease;
}

.prose .figure span {
  font-size: 13px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Small credit line beneath the page subtitle */
.page-hero .credit {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Back link ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease, gap 0.3s var(--ease-fluid);
}

.back-link:hover {
  color: var(--text);
  gap: 12px;
}

/* ---------- Contact / about ---------- */

.info-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  padding-bottom: 140px;
}

@media (max-width: 734px) {
  .info-cards {
    grid-template-columns: 1fr;
  }
}

.info-card {
  position: relative;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 40px;
  transition: background-color 0.45s ease;
}

.info-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: var(--gradient-border);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.info-card h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.info-card p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-card a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--link-underline);
  transition: border-color 0.3s ease, color 0.45s ease;
}

.info-card a:hover {
  border-color: var(--link-underline-hover);
}

/* Copy-to-clipboard button */
.with-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-btn {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, transform 0.3s var(--ease-fluid);
}

.copy-btn:hover {
  background: var(--chip-bg-hover);
  color: var(--text);
}

.copy-btn:active {
  transform: scale(0.92);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.copy-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-toast {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-fluid);
}

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

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0;
  transition: border-color 0.45s ease;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer p {
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--text);
}

/* ---------- Scroll reveal animations ---------- */

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s var(--ease-fluid), transform 0.9s var(--ease-fluid);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .card,
  .info-card,
  .theme-toggle {
    transition: none;
  }
}
