:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --text: #1c1c1c;
  --muted: #686862;
  --line: #d9d9d5;
  --focus: #255db3;
  --max-width: 70rem;

  /* Fluid space palette: 320px → 1240px */
  --space-3xs: clamp(0.25rem, 0.2065rem + 0.2174vw, 0.375rem);
  --space-2xs: clamp(0.5rem, 0.4565rem + 0.2174vw, 0.625rem);
  --space-xs: clamp(0.75rem, 0.663rem + 0.4348vw, 1rem);
  --space-s: clamp(1rem, 0.9565rem + 0.2174vw, 1.125rem);
  --space-m: clamp(1.5rem, 1.3261rem + 0.8696vw, 2rem);
  --space-l: clamp(2rem, 1.6522rem + 1.7391vw, 3rem);
  --space-xl: clamp(3rem, 2.3043rem + 3.4783vw, 5rem);
  --page-gutter: clamp(1rem, 0.3043rem + 3.4783vw, 3rem);
  --layout-gap: clamp(2.5rem, 1.8043rem + 3.4783vw, 4.5rem);

  /* Restrained fluid type scale */
  --step--1: clamp(0.8125rem, 0.7853rem + 0.1359vw, 0.875rem);
  --step-0: clamp(1rem, 0.9565rem + 0.2174vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.163rem + 0.4348vw, 1.5rem);
  --step-2: clamp(1.375rem, 1.2663rem + 0.5435vw, 1.6875rem);
  --step-3: clamp(2.25rem, 1.9891rem + 1.3043vw, 3rem);
}

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

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

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
}

.page-shell {
  width: min(100%, calc(var(--max-width) + (var(--page-gutter) * 2)));
  min-height: 100svh;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  display: grid;
  grid-template-rows: 1fr auto;
}

.portfolio-layout {
  min-width: 0;
  padding-block: var(--space-l);
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(14rem, 0.75fr);
  gap: var(--layout-gap);
  align-self: center;
  align-items: start;
}

.work-section,
.project-groups,
.project-index,
.project-list,
.project-item,
.profile-intro {
  min-width: 0;
}

.flow > * + * {
  margin-block-start: var(--flow-space, var(--space-s));
}

.section-label,
.item-kicker,
.item-label,
.profile-facts dt {
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.section-label {
  line-height: 1.4;
}

.work-section > .section-label {
  margin-block-end: var(--space-m);
}

.project-groups > * + * {
  margin-block-start: var(--space-xl);
  padding-block-start: var(--space-xl);
  border-block-start: 1px solid var(--line);
}

.project-header {
  --flow-space: var(--space-xs);
}

.project-header h2 {
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.project-summary {
  max-width: 38ch;
  font-size: var(--step-1);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.project-list {
  margin-block-start: var(--space-l);
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.project-item {
  --flow-space: var(--space-s);
  padding: var(--space-m) var(--space-s);
  background: var(--bg);
}

.item-heading {
  --flow-space: var(--space-3xs);
}

.item-heading h3 {
  font-size: var(--step-2);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.item-description {
  max-width: 31ch;
}

.item-destination {
  --flow-space: var(--space-3xs);
}

.project-link {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-weight: 700;
  line-height: 1.4;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
  transition: text-decoration-color 120ms ease;
}

.project-link:hover {
  text-decoration-color: currentColor;
}

.project-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 1px;
}

.project-url {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: var(--step--1);
  overflow-wrap: anywhere;
}

.profile-intro {
  --flow-space: var(--space-s);
  padding-block-start: var(--space-s);
  border-block-start: 1px solid var(--line);
}

.profile-intro > .section-label + * {
  margin-block-start: var(--space-m);
}

.profile-intro h2 {
  font-size: var(--step-1);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.profile-location {
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 700;
}

.profile-copy {
  max-width: 28ch;
}

.profile-facts {
  margin-block-start: var(--space-l);
  padding-block-start: var(--space-s);
  border-block-start: 1px solid var(--line);
}

.profile-facts dd {
  margin-block-start: var(--space-3xs);
}

.site-footer {
  min-width: 0;
  min-height: 52px;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--step--1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .portfolio-layout {
    grid-template-columns: minmax(0, 1fr);
    align-self: start;
  }

  .profile-intro {
    max-width: 32rem;
  }

  .profile-copy {
    max-width: 34ch;
  }
}

@media (max-width: 420px) {
  .project-item {
    padding-inline: 0;
  }

  .site-footer {
    min-height: 48px;
  }
}

@media (max-height: 720px) and (min-width: 801px) {
  .portfolio-layout {
    padding-block: var(--space-m);
  }

  .project-list,
  .profile-facts {
    margin-block-start: var(--space-m);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .project-link {
    transition: none;
  }
}
