/* Edict Display — hotlinked from color.joonasvirtanen.com (CORS: *).
   Used for the hero headline and the JV mark in the topbar. */
@font-face {
  font-family: 'Edict Display';
  src: url('https://color.joonasvirtanen.com/fonts/EdictDisplayTrial-Thin.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
/* Licensed Light + LightItalic — local files. The trial fonts had
   compromised `!` and `&` glyphs; the licensed weights render them right. */
@font-face {
  font-family: 'Edict Display';
  src: url('/EdictDisplay-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Edict Display';
  src: url('/EdictDisplay-LightItalic.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Edict Display';
  src: url('https://color.joonasvirtanen.com/fonts/EdictDisplayTrial-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Edict Display';
  src: url('https://color.joonasvirtanen.com/fonts/EdictDisplayTrial-RegularItalic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Edict Display';
  src: url('https://color.joonasvirtanen.com/fonts/EdictDisplayTrial-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #0a0a0a;
  --muted: #8a8a8a;
  --line: #ececec;
  --gap: 24px;
  --pad: 40px;
  --radius: 24px;
  --shadow:
    0 1px 2px rgba(15, 17, 22, 0.04),
    0 4px 10px rgba(15, 17, 22, 0.05),
    0 24px 60px rgba(15, 17, 22, 0.10);
  --shadow-hover:
    0 1px 2px rgba(15, 17, 22, 0.05),
    0 6px 14px rgba(15, 17, 22, 0.07),
    0 36px 80px rgba(15, 17, 22, 0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: var(--bg);
  color: var(--ink);
  /* Hard-block horizontal page scroll. Sections that use the
     `width: 100vw; margin-left: calc(50% - 50vw)` full-bleed trick can
     otherwise overflow by a scrollbar-width on desktop and by the
     wide-track width on mobile. */
  overflow-x: hidden;
}
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px var(--pad);
  gap: 24px;
}
/* Edict Display body tracking — tightened by -1% globally (see also other
   per-selector tweaks in hero.css, work.css, footer.css, cards-fan.css,
   playground.css). */
.mark {
  font-family: 'Edict Display', Georgia, serif;
  font-weight: 300;
  font-size: 22px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0;
  transition: color 160ms ease;
}
.mark:hover { color: var(--ink); }

.topnav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  align-items: center;
}
.topnav a {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: -0.005em;
  transition: color 160ms ease;
}
.topnav a:hover { color: var(--ink); }
/* Hide Work / About / Contact links from the topbar across the site —
   only Playground remains visible up top. */
.topnav a[href="/work"],
.topnav a[href="/about"],
.topnav a[href="/contact"] { display: none; }

/* (Old static hero replaced by interactive .hero-stage from hero.css) */

@media (max-width: 800px) {
  .hero { padding: 16px var(--pad) 16px; }
  /* .topnav stays visible at all widths — Work/About/Contact are already
     hidden by the explicit rule above, so only the Playground link
     remains, sitting at the right of the topbar on both desktop and
     mobile. */
  .topbar { padding: 16px var(--pad); gap: 12px; }
}

/* View toggle removed — layout is always "scroll" now. */

/* The dashboard widget grid lives only on mobile now — on desktop the
   home-page experiments live inside the hero hover popups instead, so
   we hide this whole block above 720px. */
@media (min-width: 720px) {
  #dashboard.grid { display: none; }
}

/* Bento layout (6 widgets) — fullscreen width, 5 cols. Painting + timeforms
   are both 2-col 2-row blocks (timeforms wider than the previous 1-col); the
   bottom row splits subway + waves evenly at 2 cols each. */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas:
    "clock    painting painting  timeforms timeforms"
    "today    painting painting  timeforms timeforms"
    "today    subway   subway    waves     waves";
  gap: var(--gap);
  align-content: center;
  padding: 32px var(--pad);
  width: 100%;
}

.widget[data-id="clock"]     { grid-area: clock; }
.widget[data-id="painting"]  { grid-area: painting; }
.widget[data-id="calendar"]  { grid-area: today; }
.widget[data-id="timeforms"] { grid-area: timeforms; }
.widget[data-id="subway"]    { grid-area: subway; }
.widget[data-id="waves"]     { grid-area: waves; }

/* ──────────────────────────────────────────────────────────────────
   Scroll view — horizontal scroll of mixed-size widgets, like
   collabs.joonasvirtanen.com. Overrides bento grid entirely.
   ────────────────────────────────────────────────────────────────── */
[data-view="scroll"] .grid {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-content: center;
  gap: var(--gap);
  padding: 32px var(--pad) 48px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  grid-template-areas: none;
  grid-template-columns: none;
  grid-template-rows: none;
  max-height: none;
  min-height: 0;
}
[data-view="scroll"] .grid::-webkit-scrollbar { display: none; }

[data-view="scroll"] .widget {
  flex: 0 0 auto;
  scroll-snap-align: start;
  grid-area: auto;
  aspect-ratio: auto !important;
}

/* Per-widget intentional sizes — each widget gets a shape that suits its
   content. Order is set so the visual hero (painting) leads, calendar
   anchors mid, clock is the small accent at the tail. */
[data-view="scroll"] .widget[data-id="painting"]  { width: 560px; height: 560px; order: 1; }
[data-view="scroll"] .widget[data-id="calendar"]  { width: 360px; height: 560px; order: 2; }
[data-view="scroll"] .widget[data-id="timeforms"] { width: 420px; height: 560px; order: 3; }
[data-view="scroll"] .widget[data-id="waves"]     { width: 380px; height: 500px; order: 4; }
[data-view="scroll"] .widget[data-id="subway"]    { width: 480px; height: 600px; order: 5; }
[data-view="scroll"] .widget[data-id="clock"]     { width: 280px; height: 280px; order: 6; }

/* Mobile: scroll view collapses to vertical stack (like collabs does) */
@media (max-width: 800px) {
  [data-view="scroll"] .grid {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: visible;
    height: auto;
    padding: 24px var(--pad);
    scroll-snap-type: none;
  }
  [data-view="scroll"] .widget {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
  }
  [data-view="scroll"] .widget[data-id="calendar"] { aspect-ratio: auto !important; }
  [data-view="scroll"] .widget[data-id="timeforms"],
  [data-view="scroll"] .widget[data-id="waves"]    { aspect-ratio: 3 / 4 !important; }
  [data-view="scroll"] .widget[data-id="subway"]   { aspect-ratio: 4 / 3 !important; }
}

/* Aspect ratios — drive widget sizing when grid rows are `auto`
   (i.e. on smaller breakpoints). On the desktop bento these are
   overridden by explicit grid-template-rows. */
.widget[data-id="clock"]     { aspect-ratio: 1 / 1; }
.widget[data-id="painting"]  { aspect-ratio: 1 / 1; }
.widget[data-id="timeforms"] { aspect-ratio: 3 / 4; }
.widget[data-id="waves"]     { aspect-ratio: 3 / 4; }
.widget[data-id="subway"]    { aspect-ratio: 3 / 4; }
.widget[data-id="calendar"]  { aspect-ratio: auto; }

/* Desktop bento: tracks at 1fr each, but cap so it doesn't get absurd
   on ultrawide. Painting stays roughly square because it spans 2 cols × 2 rows. */
@media (min-width: 1101px) {
  .grid {
    grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr) minmax(220px, 1fr);
    max-height: calc(100vh - 80px);
  }
  /* Grid controls sizing here; aspect-ratio is just the fallback */
  .widget { aspect-ratio: auto !important; }
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "clock     painting painting"
      "today     painting painting"
      "today     timeforms waves"
      "subway    timeforms waves";
  }
  /* Painting spans 2 cols, so make it square via row-spanned height */
  .widget[data-id="painting"]  { aspect-ratio: 2 / 1; }
  .widget[data-id="timeforms"] { aspect-ratio: 1 / 2; }
  .widget[data-id="waves"]     { aspect-ratio: 1 / 2; }
}

@media (max-width: 800px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "painting  painting"
      "today     today"
      "timeforms waves"
      "subway    clock";
  }
  .widget[data-id="painting"]  { aspect-ratio: 2 / 1; }
  .widget[data-id="timeforms"] { aspect-ratio: 3 / 4; }
  .widget[data-id="waves"]     { aspect-ratio: 3 / 4; }
  .widget[data-id="subway"]    { aspect-ratio: 1 / 1; }
  .widget[data-id="clock"]     { aspect-ratio: 1 / 1; }
}

@media (max-width: 540px) {
  :root { --pad: 16px; --gap: 16px; --radius: 18px; }
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "painting"
      "today"
      "timeforms"
      "waves"
      "subway"
      "clock";
    padding: 16px var(--pad);
  }
  .widget[data-id="painting"]  { aspect-ratio: 1 / 1; }
  .widget[data-id="timeforms"] { aspect-ratio: 3 / 4; }
  .widget[data-id="waves"]     { aspect-ratio: 3 / 4; }
  .widget[data-id="subway"]    { aspect-ratio: 3 / 4; }
  .widget[data-id="clock"]     { aspect-ratio: 1 / 1; }
  .widget[data-id="calendar"]  { aspect-ratio: auto; }
}

.widget {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 900ms cubic-bezier(0.22, 1, 0.36, 1),
              filter 900ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: 0ms, 0ms, var(--reveal-delay, 0ms), var(--reveal-delay, 0ms);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  /* Blur-reveal entrance — staggered via --reveal-delay set in app.js */
  opacity: 0;
  filter: blur(16px);
  will-change: opacity, filter;
}
.widget.is-revealed {
  opacity: 1;
  filter: blur(0);
}

/* Full-bleed widgets: the content IS the widget, no chrome around it.
   Grid cells control sizing now, so no aspect-ratio constraint. */
.widget[data-widget="painting"],
.widget[data-widget="iframe"] {
  padding: 0;
  background: #f4f4f4;
}

.widget-linked {
  cursor: pointer;
  outline: none;
}
.widget-linked:hover,
.widget-linked:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.widget-linked:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.widget-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.widget-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.widget-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.widget-body { flex: 1; }

/* ---- iframe (full-bleed) ---- */
.iframe-fill {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
}

/* ---- clock ---- */
.clock-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}
.clock-svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.06));
}

/* ---- painting (full-bleed image, cropped to portrait card) ---- */
.painting-figure {
  display: block;
  width: 100%;
  height: 100%;
}
.painting-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ---- calendar (bolder, larger, more editorial) ---- */
.widget[data-id="calendar"] .widget-header {
  margin-bottom: 22px;
  padding-bottom: 16px;
}
.widget[data-id="calendar"] .widget-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: none;
}
.widget[data-id="calendar"] .widget-meta {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}
.cal-weather {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 26px;
  line-height: 1.4;
  font-weight: 500;
}
.cal-weather strong {
  color: var(--ink);
  font-weight: 700;
}
.cal-event {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.cal-event:last-child { border-bottom: none; }
.cal-event a, a.cal-event {
  color: inherit;
  text-decoration: none;
}
a.cal-event:hover .cal-title { text-decoration: underline; }
.cal-time {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  padding-top: 2px;
}
.cal-detail { font-size: 16px; line-height: 1.35; }
.cal-title {
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.cal-where {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.widget-error {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
