/* Layout: a compact field of LED-style dots carries an oversized PLGRM wordmark, with links above it
   and the email under the name. Works and Code sit side by side at every screen size, in rows that
   both columns share so the thumbnails line up. Tapping a work opens its Vimeo player over the page. */

:root {
  --bg: #0b1113;
  --surface: #121c1f;
  --fg: #e6ece9;
  --muted: #8f9f9c;
  --line: #1f2e31;
  --accent: #ff6b9c;
  --backdrop: rgba(5, 8, 9, 0.82);
  --video-bg: #000000;
  --dot-l: 62%;
  --ph-a: 24%;
  --ph-b: 14%;
  --ph-dot: 62%;
  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-jp: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --gutter: clamp(16px, 4vw, 56px);
  --card-gap: clamp(1rem, 2.5vw, 1.75rem);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef0eb;
    --surface: #e1e5df;
    --fg: #11191b;
    --muted: #566664;
    --line: #cdd5cf;
    --accent: #b0124d;
    --dot-l: 38%;
    --ph-a: 80%;
    --ph-b: 68%;
    --ph-dot: 38%;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #eef0eb;
  --surface: #e1e5df;
  --fg: #11191b;
  --muted: #566664;
  --line: #cdd5cf;
  --accent: #b0124d;
  --dot-l: 38%;
  --ph-a: 80%;
  --ph-b: 68%;
  --ph-dot: 38%;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-display);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 8px;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: 3px;
}

.skip:focus {
  top: 8px;
}

/* Header */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-inner {
  position: relative;
  padding-block: 1rem 1.75rem;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-bottom: clamp(1rem, 3.5vw, 2.25rem);
  font-size: 0.95rem;
}

.mark {
  margin: 0;
  font-size: clamp(3.25rem, 15vw, 9rem);
  font-weight: 800;
  font-variation-settings: "wdth" 75;
  line-height: 0.85;
  letter-spacing: -0.035em;
  max-width: 100%;
}

.who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0.9rem 0 0;
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  line-height: 1.2;
}

.name {
  font-weight: 500;
}

.kanji {
  font-family: var(--f-jp);
  font-weight: 500;
}

.role {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.contact {
  margin: 0.35rem 0 0;
  font-size: clamp(0.9rem, 0.8rem + 0.5vw, 1.05rem);
  overflow-wrap: anywhere;
}

.contact a {
  text-decoration-color: var(--accent);
}

/* Works and Code, side by side */

.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(0.75rem, 3vw, 2.5rem);
  row-gap: var(--card-gap);
  align-items: start;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 8vw, 5rem);
}

.col {
  min-width: 0;
}

.section-head {
  margin-bottom: var(--card-gap);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.75rem);
  font-weight: 700;
  font-variation-settings: "wdth" 85;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.status {
  margin: 0;
  color: var(--muted);
}

.works,
.code {
  display: grid;
  gap: var(--card-gap);
}

/* Both columns share one set of rows, so a thumbnail in Works sits level with its neighbor in Code
   whatever the text under each one does. Browsers without subgrid fall back to two independent stacks. */
@supports (grid-template-rows: subgrid) {
  .columns {
    grid-template-rows: auto repeat(var(--rows, 1), auto);
  }

  .col {
    display: grid;
    grid-row: 1 / -1;
    grid-template-rows: subgrid;
  }

  .section-head {
    margin-bottom: 0;
  }

  .works,
  .code {
    grid-row: 2 / -1;
    grid-template-rows: subgrid;
    row-gap: normal;
  }
}

.work,
.repo {
  min-width: 0;
}

.work a,
.repo a {
  display: block;
  text-decoration: none;
}

/* Thumbnails (shared by works and code) */

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface);
}

.thumb img,
.thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.noimg {
  background:
    radial-gradient(circle at center, hsl(var(--h, 200) 70% var(--ph-dot) / 0.55) 0 1.2px, transparent 1.8px) 0 0 / 10px 10px,
    linear-gradient(135deg, hsl(var(--h, 200) 45% var(--ph-a)), hsl(calc(var(--h, 200) + 50) 50% var(--ph-b)));
}

.work-title,
.repo-title {
  display: block;
  margin-top: 0.5rem;
  font-size: clamp(0.8rem, 0.55rem + 1vw, 1.05rem);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.work-note {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.work a:hover .thumb img,
.repo a:hover .thumb img {
  filter: brightness(1.1);
}

.work a:hover .work-title,
.repo a:hover .repo-title {
  color: var(--accent);
}

/* Video window: just the player. Clicking or tapping outside it closes it. */

.player {
  width: min(96vw, calc((100dvh - 2rem) * 16 / 9), 1100px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--video-bg);
  overflow: hidden;
}

.player:focus {
  outline: none;
}

.player::backdrop {
  background: var(--backdrop);
}

.player-frame {
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: var(--video-bg);
}

.player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
