/* NishikawaButterfly — hand-written styles, no build step.
   Palette shared with the project UIs: deep navy #0b1f33, greens #098764 / #32d6a0. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-card: #f5f8f9;
  --text: #14283a;
  --muted: #4a5a68;
  --link: #0a6b50;
  --link-hover: #098764;
  --border: #d6dee4;

  --header-bg: #0b1f33;
  --header-text: #e8eef4;
  --header-link: #d7e0ea;
  --header-accent: #32d6a0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081625;
    --bg-card: #0e2337;
    --text: #d9e2ea;
    --muted: #9fb2c2;
    --link: #32d6a0;
    --link-hover: #5ee3b7;
    --border: #21405c;
  }
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
  width: 100%;
}

/* Type scale */

h1 {
  font-size: clamp(1.65rem, 1.2rem + 2vw, 2.3rem);
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
  line-height: 1.25;
  margin: 2.5rem 0 0.5rem;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

p,
ul,
ol {
  max-width: 70ch;
  margin: 0 0 1rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  color: var(--header-accent);
  padding: 0.5rem 1rem;
}

.skip-link:focus {
  left: 0;
}

/* Header */

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 2px solid #098764;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.85rem;
}

.site-name {
  color: var(--header-text);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-name:hover {
  color: var(--header-accent);
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--header-link);
  text-decoration: none;
  padding-block: 0.25rem;
}

.site-nav a:hover {
  color: var(--header-accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.site-nav a[aria-current="page"] {
  color: var(--header-accent);
  border-bottom: 2px solid var(--header-accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--header-link);
  border-radius: 4px;
  color: var(--header-text);
  font: inherit;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: var(--header-accent);
  color: var(--header-accent);
}

/* Collapsed nav only applies when JS is running (html.js) on narrow screens. */
@media (max-width: 38em) {
  html.js .nav-toggle {
    display: inline-block;
  }

  html.js .site-nav {
    display: none;
    flex-basis: 100%;
  }

  html.js .site-nav.open {
    display: block;
  }

  html.js .site-nav ul {
    flex-direction: column;
    gap: 0.25rem;
    padding-block: 0.5rem;
  }

  html.js .site-nav a {
    display: block;
    padding-block: 0.5rem;
  }
}

/* Main */

main {
  flex: 1;
  padding-block: 2.5rem 3.5rem;
}

.lede {
  color: var(--muted);
}

.role {
  color: var(--muted);
  font-size: 1.15rem;
  margin-top: -0.75rem;
}

.identity {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Cards */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #098764;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-block: 1.25rem;
}

.card :last-child {
  margin-bottom: 0;
}

.hook {
  color: var(--muted);
}

/* Project entries */

.project {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 2rem;
}

.project h2 {
  margin-top: 0;
}

/* Project cards (generated by tools/build_projects.js) */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: 1.25rem;
  margin-block: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--header-bg);
  border-bottom: 2px solid #098764;
}

.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.card-media.contain img {
  object-fit: contain;
}

.card-media-text {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  color: var(--header-accent);
  text-align: center;
  padding-inline: 1rem;
  overflow-wrap: anywhere;
}

.card-slug::before {
  content: "> ";
  color: var(--header-link);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.1rem 1.25rem;
}

.card-body h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.card-limit {
  color: var(--muted);
  font-size: 0.95rem;
}

.card-body .links {
  margin-top: auto;
  padding-top: 0.5rem;
  margin-bottom: 0;
}

.tech {
  color: var(--muted);
  font-size: 0.95rem;
}

.links {
  font-size: 0.95rem;
}

/* Footer */

.site-footer {
  background: var(--header-bg);
  color: var(--header-text);
  border-top: 2px solid #098764;
  padding-block: 1.5rem;
  font-size: 0.95rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
}

.site-footer p:last-child {
  margin-bottom: 0;
  color: var(--header-link);
}

.site-footer a {
  color: var(--header-accent);
}

.site-footer a:hover {
  color: #5ee3b7;
}
