/* Landing page: sticky intro on the left, work grid on the right, about and contact below.
   Header matches the IdrætsID project page. */

.home {
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace; --wide: var(--page-max);
  --blue: #4a63e8; --blue-hover: #3a52d4; --blue-ink: #ffffff;
}
.home .wrap-wide { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.home ::selection { background: var(--blue); color: var(--blue-ink); }
.btn-blue { background: var(--blue); color: var(--blue-ink); }
.btn-blue:hover, [data-theme="light"] .btn-blue:hover { background: var(--blue-hover); }
.home .scroll-progress span { background: var(--blue); }
.home .theme-switch[aria-checked="true"] .theme-track { background: var(--blue); }

/* Header, same type as the project page. The name fades in once the intro's own name scrolls away */
.home-head .wrap { max-width: var(--wide); }
.home-head .site-name, .home-head .site-nav { font-family: var(--mono); font-weight: 700; }
.home-head .site-name { opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out), visibility 0.3s; }
.home-head.show-name .site-name { opacity: 1; visibility: visible; transform: none; }
.home-head .wrap { justify-content: space-between; }

/* Intro + work */
.home-top { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(32px, 4vw, 64px); padding-top: 24px; }
.home-intro { position: sticky; top: 100px; align-self: start; display: flex; flex-direction: column; min-height: calc(100vh - 124px); padding-bottom: 32px; }
.home-intro h1 { font-family: var(--mono); font-weight: 700; font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); line-height: 1.1; }
.home-role { margin-top: 6px; color: var(--fg-2); }
.home-lede { margin-top: 22px; color: var(--fg-2); line-height: 1.6; }
.home-lede strong { color: var(--fg); font-weight: 500; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
/* "Get in touch" and "Download my CV" share one width */
.home-actions .btn, .about2-side .btn { width: 220px; max-width: 100%; justify-content: center; }
.home .btn { border-radius: 2px; }
.home .btn svg { width: 16px; height: 16px; }
.home-links { margin-top: auto; padding-top: 40px; display: grid; gap: 6px; }
.home-links a { display: inline-flex; align-items: center; gap: 6px; width: fit-content; color: var(--fg-2); text-decoration: none; }
.home-links a:hover { color: var(--fg); }
.home-links svg { width: 12px; height: 12px; }

/* Abstract titles that filter the grid */
.work-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; margin-bottom: 18px; min-height: 26px; }
.work-filter button {
  display: inline-flex; align-items: center; gap: 8px; padding: 2px 0;
  font: inherit; font-weight: 500; color: var(--fg-3); background: none; border: 0; cursor: pointer;
  transition: color 0.2s;
}
.work-filter button:hover, .work-filter button[aria-pressed="true"] { color: var(--fg); }
.work-filter button::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity 0.2s, background-color 0.2s; }
.work-filter button[aria-pressed="true"]::after { opacity: 1; background: var(--blue); }

.work-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.work-card { position: relative; margin: 0; }
.work-card.is-wide { grid-column: 1 / -1; }
.work-card[hidden] { display: none; }
.work-card.is-entering { animation: card-in 0.5s var(--ease-out) both; }

/* Bento layout when all projects show: six columns, sizes vary card to card.
   Row height follows the section width so the proportions hold at every desktop size.
   Filtering falls back to the even two-column grid so no holes appear. */
#work { container-type: inline-size; }
@media (min-width: 761px) {
  .work-grid2:not(.is-filtered) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: calc(100cqw / 14);
    grid-auto-flow: dense;
  }
  .work-grid2:not(.is-filtered) .work-card { grid-column: span 3; grid-row: span 5; }
  .work-grid2:not(.is-filtered) .work-card:nth-child(1) { grid-column: span 4; grid-row: span 6; }
  .work-grid2:not(.is-filtered) .work-card:nth-child(2) { grid-column: span 2; grid-row: span 6; }
  .work-grid2:not(.is-filtered) .work-card:nth-child(3) { grid-column: span 2; }
  .work-grid2:not(.is-filtered) .work-card:nth-child(4) { grid-column: span 4; }
  .work-grid2:not(.is-filtered) .work-card:nth-child(7) { grid-column: span 6; }
  .work-grid2:not(.is-filtered) .work-card > a,
  .work-grid2:not(.is-filtered) .work-card > .work-card-in { height: 100%; }
  .work-grid2:not(.is-filtered) .work-card .work-media { height: 100%; aspect-ratio: auto; }
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.work-card > a, .work-card > .work-card-in { display: block; position: relative; color: inherit; text-decoration: none; }
.work-media { aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--stage); clip-path: inset(0 0 0 0 round 6px); transition: clip-path 0.6s var(--ease-out); }
.work-card.is-wide .work-media { aspect-ratio: 16 / 9; }
.work-media img { width: 100%; height: 100%; object-fit: cover; }

/* Hover: the image's bottom lifts and the caption comes in, like the project page figures */
.work-card { container-type: inline-size; }
.work-card > * { --cap: 100px; }
.work-cap {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--cap);
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 28px;
  padding: 0 4px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-out);
}
.work-cap-text p { color: var(--fg); font-size: var(--step--1); line-height: 1.5; max-width: 56ch; }
.work-cap-text .note { margin-top: 2px; color: var(--fg-3); }
.work-cap-id { display: grid; grid-template-columns: 40px auto; align-items: center; gap: 12px; text-align: left; order: -1; }

/* Keywords and project type sit on the image while hovering */
.work-media { position: relative; }
.work-over {
  position: absolute; inset: 0; padding: 14px; padding-bottom: 14px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  pointer-events: none; opacity: 0; transition: opacity 0.35s var(--ease-out), padding-bottom 0.6s var(--ease-out);
}
.work-type { align-self: flex-end; }
.work-tags li::first-letter { text-transform: uppercase; }
.work-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.work-type, .work-tags li {
  padding: 4px 10px; border-radius: 4px; font-size: 12px; line-height: 1.4; color: #fff;
  background: rgba(14, 14, 16, 0.42); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.work-cap-id h3 { font-size: var(--step-0); font-weight: 500; line-height: 1.25; white-space: nowrap; }
.work-cap-id span { display: block; color: var(--fg-2); font-size: var(--step--1); white-space: nowrap; }
@media (hover: hover) {
  .work-card:hover .work-media, .work-card:focus-within .work-media { clip-path: inset(0 0 var(--cap) 0 round 6px); }
  .work-card:hover .work-cap, .work-card:focus-within .work-cap { opacity: 1; transform: none; transition-delay: 0.08s; }
  .work-card:hover .work-over, .work-card:focus-within .work-over { opacity: 1; padding-bottom: calc(var(--cap) + 14px); transition-delay: 0.08s, 0s; }
}
/* Narrow cards: logo and title sit above the text, and the lift is taller */
@container (max-width: 440px) {
  .work-card > * { --cap: 128px; }
  .work-cap { grid-template-columns: 1fr; align-content: center; gap: 8px; }
  .work-cap-id { grid-template-columns: 32px auto; }
  .work-cap-id .logo-tile { width: 32px; height: 32px; }
  .work-cap-id h3, .work-cap-id span { white-space: normal; }
  .work-cap-text p:not(.kw) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
/* Touch: a tap opens the same state as hover (see site.js) */
.work-card.is-open .work-media { clip-path: inset(0 0 var(--cap) 0 round 6px); }
.work-card.is-open .work-cap { opacity: 1; transform: none; transition-delay: 0.08s; }
.work-card.is-open .work-over { opacity: 1; padding-bottom: calc(var(--cap) + 14px); transition-delay: 0.08s, 0s; }
@media (hover: none) {
  .work-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
}
@media (prefers-reduced-motion: reduce) { .work-media, .work-cap, .work-card.is-entering { transition: none; animation: none; } }

/* Logos without a background; some have a light and a dark version */
.logo-tile { display: grid; place-items: center; width: 40px; height: 40px; }
.logo-tile img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.logo-tile .on-light { display: none; }
[data-theme="light"] .logo-tile .on-dark { display: none; }
[data-theme="light"] .logo-tile .on-light { display: block; }

/* About */
.about2 { margin-top: clamp(96px, 12vw, 160px); padding-block: clamp(64px, 8vw, 112px); background: var(--stage); }
.about2-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 760px); justify-content: center; gap: clamp(32px, 5vw, 88px); }
.about2-side > .about2-photo:first-child { margin-top: 0; }
.about2 h2 { font-family: var(--mono); font-weight: 700; font-size: var(--step-3); }
.about2-photo { display: block; width: 240px; height: auto; margin-top: 24px; }
.about2-side p { margin-top: 18px; color: var(--fg-2); font-size: var(--step--1); line-height: 1.65; }
.about2-side .btn { margin-top: 26px; }

.about2-main h3 { font-size: var(--step-2); font-weight: 600; color: var(--blue); margin-bottom: 6px; }
.about2-main h3 + .tl { margin-top: 0; }
.about2-main section + section { margin-top: 48px; }
.tl li { display: grid; grid-template-columns: 40px minmax(0, 520px) auto; justify-content: start; gap: 4px 18px; padding: 16px 0; }
.tl .when { margin-left: 22px; }
.tl .logo-tile { grid-row: 1 / span 2; }
.tl b { font-weight: 500; }
.tl .org { color: var(--fg-2); }
.tl .when { grid-column: 3; grid-row: 1; color: var(--fg-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl .what { grid-column: 2 / -1; margin-top: 6px; color: var(--fg-2); font-size: var(--step--1); line-height: 1.55; }

.about2-lists { display: grid; grid-template-columns: repeat(3, max-content); justify-content: start; gap: 32px clamp(40px, 5vw, 72px); }
.about2-lists ul { color: var(--fg-2); }
.about2-lists li { padding-block: 3px; }

.home-foot .wrap { max-width: var(--wide); align-items: center; }
.home-foot-contact { display: flex; gap: 24px; flex-wrap: wrap; }

@media (max-width: 1000px) {
  .home-top, .about2-grid { grid-template-columns: 1fr; }
  .home-intro { position: static; min-height: 0; }
  .home-links { margin-top: 0; padding-top: 24px; display: flex; flex-wrap: wrap; gap: 6px 20px; }
}
@media (max-width: 760px) {
  .work-grid2 { grid-template-columns: 1fr; }
  .work-card.is-wide .work-media { aspect-ratio: 4 / 3; }
  .about2-lists { grid-template-columns: 1fr 1fr; }
  .tl li { grid-template-columns: 40px minmax(0, 1fr); }
  .tl .when { grid-column: 2; grid-row: auto; margin-left: 0; }
}
