/* creative.matias.us. Same token system as matias.us:
   core values, then semantic tokens; themes only remap the semantic layer. */

:root {
  /* Core */
  --core-white: #ffffff;
  --core-gray-50: #f2f2f2;
  --core-gray-200: #e0e0e0;
  --core-gray-600: #5c5c5c;
  --core-gray-400: #a1a1a6;
  --core-gray-800: #2a2a2a;
  --core-gray-900: #141414;
  --core-black: #000000;
  --core-magenta-400: #ff2bd6;
  --core-magenta-500: #ff00c8;
  --core-magenta-600: #d4008c;

  /* Semantic, light theme (default) */
  --color-bg: var(--core-white);
  --color-surface: var(--core-gray-50);
  --color-text: var(--core-black);
  --color-text-secondary: var(--core-gray-600);
  --color-border-subtle: var(--core-gray-200);
  --color-border-strong: var(--core-black);
  --color-action-bg: var(--core-black);
  --color-action-text: var(--core-white);
  --color-accent: var(--core-magenta-500);       /* marks and lines: 3:1 or better */
  --color-accent-text: var(--core-magenta-600);  /* small text: 4.5:1 or better */
  --color-header-bg: rgba(255, 255, 255, .86);

  /* Type and space */
  --font-sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --space-section: 120px;
  --space-gutter: 32px;
  --size-wide: 1200px;
  --radius-full: 999px;
  --radius-image: 20px;
  --space-frame: 8px;
  --radius-frame: calc(var(--radius-image) + var(--space-frame)); /* nested corners stay concentric */
  color-scheme: light;
}

:root[data-theme="dark"] {
  --color-bg: var(--core-black);
  --color-surface: var(--core-gray-900);
  --color-text: var(--core-white);
  --color-text-secondary: var(--core-gray-400);
  --color-border-subtle: var(--core-gray-800);
  --color-border-strong: var(--core-white);
  --color-action-bg: var(--core-white);
  --color-action-text: var(--core-black);
  --color-accent: var(--core-magenta-500);
  --color-accent-text: var(--core-magenta-400);
  --color-header-bg: rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); font-size: 18px; line-height: 1.55; -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s; }
h1, h2, h3, p, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 2px; }
.skip-link { position: absolute; left: 16px; top: -48px; background: var(--color-action-bg); color: var(--color-action-text); padding: 8px 14px; z-index: 30; text-decoration: none; }
.skip-link:focus { top: 12px; }
.wrap { max-width: calc(var(--size-wide) + var(--space-gutter) * 2); margin: 0 auto; padding: 0 var(--space-gutter); }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--color-header-bg); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 20px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.nav a { text-decoration: none; color: var(--color-text-secondary); }
.nav a:hover, .nav a[aria-current] { color: var(--color-text); }
.tool { display: inline-flex; align-items: center; background: none; border: 0; padding: 4px 0; color: var(--color-text-secondary); cursor: pointer; }
.tool:hover { color: var(--color-text); }
.theme-icon { width: 18px; height: 18px; }
.theme-icon .moon { display: none; }
:root[data-theme="dark"] .theme-icon .sun { display: none; }
:root[data-theme="dark"] .theme-icon .moon { display: inline; }

/* Home */
.intro { padding: 104px 0 96px; }
.intro h1 { font-size: clamp(48px, 9vw, 128px); line-height: .94; letter-spacing: -.05em; font-weight: 650; }
.intro h1 span { display: block; color: var(--color-text-secondary); }
.section { padding: 96px 0; border-top: 1px solid var(--color-border-subtle); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(32px, 4.2vw, 56px); line-height: 1.04; letter-spacing: -.035em; font-weight: 650; }
.section-head p { color: var(--color-text-secondary); font-size: 16px; max-width: 44ch; }

.covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 24px; list-style: none; margin: 0; padding: 0; }
.covers.wide { grid-template-columns: repeat(2, 1fr); }
.cover a { display: block; text-decoration: none; }
.cover .frame { background: var(--color-surface); border-radius: var(--radius-image); overflow: hidden; aspect-ratio: 4 / 5; }
.covers.wide .frame { aspect-ratio: 3 / 2; }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.cover a:hover img { transform: scale(1.03); }
.cover .meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; align-items: baseline; }
.cover h3 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.cover .count { font-size: 14px; color: var(--color-text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cover a:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

.about p { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.35; letter-spacing: -.02em; max-width: 30ch; font-weight: 500; }

/* Gallery and project pages */
.page-head { padding: 88px 0 56px; }
.back { font-size: 15px; color: var(--color-text-secondary); text-decoration: none; display: inline-block; margin-bottom: 24px; }
.back:hover { color: var(--color-text); }
.page-head h1 { font-size: clamp(44px, 7vw, 96px); line-height: .98; letter-spacing: -.045em; font-weight: 650; }
.page-head p { color: var(--color-text-secondary); font-size: 20px; line-height: 1.5; margin-top: 24px; max-width: 46ch; }
.masonry { columns: 3 320px; column-gap: 16px; padding-bottom: 96px; }
.masonry a { display: block; break-inside: avoid; margin-bottom: 16px; border-radius: 12px; overflow: hidden; background: var(--color-surface); }
.masonry img { width: 100%; transition: opacity .2s; }
.masonry a:hover img { opacity: .9; }

.project { padding: 56px 0; border-top: 1px solid var(--color-border-subtle); }
.project:last-child { padding-bottom: 96px; }
.project h2 { font-size: clamp(26px, 3vw, 36px); letter-spacing: -.03em; font-weight: 650; line-height: 1.1; }
.project > p { color: var(--color-text-secondary); margin-top: 10px; max-width: 56ch; font-size: 17px; }
.stack { display: grid; gap: 16px; margin-top: 32px; }
.stack.two { grid-template-columns: 1fr 1fr; }
.stack a { display: block; border-radius: 12px; overflow: hidden; background: var(--color-surface); }

.videos { display: grid; grid-template-columns: 1fr 1fr; gap: 48px 24px; list-style: none; margin: 0; padding: 0 0 96px; }
.video .player { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--color-surface); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin-top: 14px; }
.video p { font-size: 15px; color: var(--color-text-secondary); margin-top: 4px; }
.video .pw { color: var(--color-accent-text); }

.foot { border-top: 1px solid var(--color-border-subtle); padding: 28px 0 40px; font-size: 14px; color: var(--color-text-secondary); }

/* Lightbox */
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(0,0,0,.94); color: #fff; }
.lightbox::backdrop { background: rgba(0,0,0,.94); }
.lightbox[open] { display: grid; grid-template-columns: 72px 1fr 72px; grid-template-rows: 56px 1fr 56px; }
.lightbox figure { grid-column: 2; grid-row: 2; display: grid; place-items: center; min-height: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 112px); width: auto; height: auto; object-fit: contain; }
.lightbox button { background: none; border: 0; color: #fff; cursor: pointer; font: 500 15px var(--font-sans); opacity: .8; }
.lightbox button:hover { opacity: 1; }
.lightbox .close { grid-column: 3; grid-row: 1; }
.lightbox .prev { grid-column: 1; grid-row: 2; font-size: 32px; }
.lightbox .next { grid-column: 3; grid-row: 2; font-size: 32px; }
.lightbox .pos { grid-column: 2; grid-row: 3; align-self: center; text-align: center; font-size: 14px; opacity: .7; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  :root { --space-gutter: 20px; }
  .nav { gap: 14px; font-size: 13px; }
  .intro { padding: 64px 0 56px; }
  .section { padding: 64px 0; }
  .covers { grid-template-columns: 1fr 1fr; gap: 28px 14px; }
  .covers.wide, .videos, .stack.two { grid-template-columns: 1fr; }
  .cover h3 { font-size: 17px; }
  .page-head { padding: 56px 0 36px; }
  .masonry { columns: 2; column-gap: 10px; }
  .masonry a { margin-bottom: 10px; border-radius: 8px; }
  .lightbox[open] { grid-template-columns: 44px 1fr 44px; }
}
@media (max-width: 420px) { .nav .hide-xs { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.vlist { list-style: none; margin: 0; padding: 0; columns: 2 320px; column-gap: 24px; border-top: 1px solid var(--color-border-strong); }
.vlist li { break-inside: avoid; border-bottom: 1px solid var(--color-border-subtle); }
.vlist a { display: block; padding: 18px 0; font-size: 20px; font-weight: 600; letter-spacing: -.015em; text-decoration: none; }
.vlist a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.video { scroll-margin-top: 80px; }
