/* ============================================================
 * そういちろう ぽーたる — Variant B (Casual / いってつ tone)
 * Mobile-first. BEM-ish naming under the b-casual flavor.
 * ============================================================ */

:root {
  --bg: #fff6e8;
  --bg-card: #fffdf7;
  --bg-soft: #faecd5;
  --text: #2d2a26;
  --text-soft: #5b524a;
  --meta: #bfa68c;
  --accent-warm: #e76f51;
  --accent-warm-deep: #c0573b;
  --accent-cool: #2a9d8f;
  --accent-cool-deep: #1f7a70;
  --border: #ead7be;
  --shadow-sm: 0 2px 6px rgba(168, 124, 78, 0.10);
  --shadow-md: 0 6px 18px rgba(168, 124, 78, 0.14);
  --shadow-lg: 0 14px 32px rgba(168, 124, 78, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --font-body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic UI", system-ui, sans-serif;
  --container: 840px;
  --container-wide: 1120px;
  --gap-section: clamp(48px, 8vw, 88px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1c18;
    --bg-card: #2a2622;
    --bg-soft: #3a322b;
    --text: #f0e8da;
    --text-soft: #cfc4b3;
    --meta: #9b8a72;
    --border: #4a3f33;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 14px 32px rgba(0, 0, 0, 0.55);
  }
}

/* --- reset & base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0 0 1em; }
a {
  color: var(--accent-warm);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .2s ease;
}
a:hover { color: var(--accent-warm-deep); }
a:focus-visible {
  outline: 3px solid var(--accent-warm);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- utilities --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--accent-warm);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  z-index: 999;
}
.skip-link:focus { top: 16px; }

/* --- header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.site-header__brand {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}
.site-header__brand a {
  color: var(--text);
  text-decoration: none;
}
.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: .92rem;
}
.site-nav__list a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.site-nav__list a:hover { color: var(--accent-warm); background: var(--bg-soft); }

/* --- hero --- */
.hero { padding: clamp(40px, 7vw, 72px) 0 clamp(28px, 4vw, 40px); }
.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}
.hero__avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow-md);
}
.hero__hello {
  margin: 0 0 .2em;
  font-size: 1rem;
  color: var(--accent-warm);
  font-weight: 700;
  letter-spacing: .02em;
}
.hero__name {
  margin: 0 0 .5em;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: .02em;
}
.hero__tagline {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
  max-width: 32em;
}
@media (min-width: 720px) {
  .hero__inner { flex-direction: row; text-align: left; gap: 36px; }
}

/* --- section common --- */
section { padding: var(--gap-section) 0; }
.section-heading {
  margin: 0 0 .6em;
  font-size: clamp(1.4rem, 3vw, 1.7rem);
  font-weight: 700;
  position: relative;
  padding-left: 18px;
}
.section-heading::before {
  content: "";
  position: absolute;
  left: 0; top: .35em;
  width: 8px; height: 1em;
  background: var(--accent-warm);
  border-radius: var(--radius-pill);
}

/* --- about --- */
.about__bio p {
  color: var(--text-soft);
  margin-bottom: 1.2em;
}
.about__bio p:last-child { margin-bottom: 0; }

/* --- recent --- */
.recent__list {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .recent__list { grid-template-columns: 1fr 1fr; }
}
.recent__item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.recent__label {
  margin: 0 0 .3em;
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent-cool);
  letter-spacing: .04em;
}
.recent__text {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
}

/* --- skills --- */
.skills__lead { color: var(--text-soft); margin-bottom: 1.6em; }
.skill-group { margin-bottom: 22px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group__title {
  margin: 0 0 .6em;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-soft);
}
.skill-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.skill-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: .9rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1.4;
}
.skill-pill--work { background: #fff1d6; color: #8a5a0e; border-color: #f1d9a4; }
.skill-pill--web  { background: #d8f1ee; color: var(--accent-cool-deep); border-color: #b5e0d9; }
.skill-pill--tcg  { background: #fce0d9; color: var(--accent-warm-deep); border-color: #f5c2b5; }
.skill-pill--trpg { background: #ecdff7; color: #6e3aa0; border-color: #d6c2ec; }
.skill-pill--life { background: #f3ebda; color: #7a6243; border-color: #e1d3b6; }
@media (prefers-color-scheme: dark) {
  .skill-pill { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
  .skill-pill--work, .skill-pill--web, .skill-pill--tcg, .skill-pill--trpg, .skill-pill--life {
    background: var(--bg-soft); border-color: var(--border);
  }
  .skill-pill--work { color: #f3c97b; }
  .skill-pill--web  { color: #7ed3c9; }
  .skill-pill--tcg  { color: #f3a892; }
  .skill-pill--trpg { color: #c8a8eb; }
  .skill-pill--life { color: #e0cea4; }
}

/* --- works --- */
.works__lead { color: var(--text-soft); margin-bottom: 1.4em; }
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .work-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
.work-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.work-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.work-card__link:focus-visible {
  outline: 3px solid var(--accent-warm);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}
.work-card__thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.work-card__body { padding: 16px 18px 18px; }
.work-card__title {
  margin: 0 0 .4em;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.work-card__desc {
  margin: 0 0 .6em;
  color: var(--text-soft);
  font-size: .95rem;
  line-height: 1.7;
}
.work-card__tech {
  margin: 0;
  font-size: .78rem;
  color: var(--meta);
  letter-spacing: .04em;
}

/* --- note articles --- */
.note-articles__lead { color: var(--text-soft); margin-bottom: 1.4em; }
.note-articles__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.note-articles__item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.note-articles__item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.note-articles__link {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
  min-height: 44px;
  padding: 14px 18px;
  color: inherit;
  text-decoration: none;
}
.note-articles__link:focus-visible {
  outline: 3px solid var(--accent-warm);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}
.note-articles__source {
  flex: 0 0 auto;
  align-self: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--accent-cool-deep);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.note-articles__title {
  flex: 1 1 14em;
  min-width: 0;
  color: var(--text);
  font-size: .96rem;
  font-weight: 700;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.note-articles__link:hover .note-articles__title { color: var(--accent-warm-deep); }
.note-articles__arrow {
  flex: 0 0 auto;
  align-self: center;
  color: var(--accent-warm);
  font-weight: 700;
  transition: transform .2s ease;
}
.note-articles__link:hover .note-articles__arrow { transform: translateX(3px); }
.note-articles__more {
  margin: 1.4em 0 0;
  text-align: center;
  font-weight: 700;
}
@media (prefers-color-scheme: dark) {
  .note-articles__source { background: var(--bg-soft); color: #7ed3c9; }
}
@media (prefers-reduced-motion: reduce) {
  .note-articles__item,
  .note-articles__arrow { transition: none; }
}

/* --- links --- */
.links__lead { color: var(--text-soft); margin-bottom: 1.2em; }
.links__list {
  display: grid;
  gap: 10px;
  margin-bottom: 1.4em;
}
.links__item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.links__service {
  font-weight: 700;
  color: var(--text);
  font-size: .95rem;
}
.links__url {
  color: var(--accent-warm);
  font-size: .95rem;
  word-break: break-all;
}
.links__outro {
  margin: 0;
  color: var(--accent-warm);
  font-weight: 700;
  text-align: center;
}

/* --- footer --- */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 28px 0 36px;
  margin-top: var(--gap-section);
}
.site-footer__inner { text-align: center; }
.site-footer__copy {
  margin: 0 0 .8em;
  font-weight: 700;
  font-size: .95rem;
}
.site-footer__privacy,
.site-footer__tm {
  margin: 0 0 .8em;
  color: var(--text-soft);
  font-size: .82rem;
  line-height: 1.7;
}
.site-footer__tm { margin-bottom: 0; }
.site-footer a { color: var(--accent-warm); }

/* --- intersection-observer fade-in helper --- */
.is-fade-target {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
  will-change: opacity, transform;
}
.is-fade-target.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .is-fade-target { opacity: 1; transform: none; transition: none; }
}

/* --- 404 / privacy specific --- */
.page-narrow { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.page-narrow h2 { font-size: 1.2rem; margin-top: 1.6em; }
.page-narrow ul.disc { list-style: disc; padding-left: 1.2em; color: var(--text-soft); }
.page-narrow ul.disc li { margin-bottom: .4em; }
.page-back { display: inline-block; margin-top: 1.6em; font-weight: 700; }

/* ============================================================
 * Skills grid wrapper (mobile = single col, used by desktop layout below)
 * Wraps .skill-group children inside the skills section.
 * ============================================================ */
.skills__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
.skills__grid .skill-group { margin-bottom: 0; }

/* ============================================================
 * Tablet (>=768px) — slightly more breathing room
 * Container stays at 840px (existing default). Add 2-col affordances.
 * ============================================================ */
@media (min-width: 768px) {
  .container { padding: 0 28px; }
  .skills__grid { grid-template-columns: 1fr 1fr; gap: 24px 32px; }
  .links__list { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
}

/* ============================================================
 * Desktop (>=1024px) — wider container, multi-column layouts.
 * This is the main fix for "horizontal space wasted on PC".
 * ============================================================ */
@media (min-width: 1024px) {
  .container { max-width: var(--container-wide); padding: 0 32px; }

  /* Hero — asymmetric: avatar left, copy right, warm-cream block behind */
  .hero { padding: clamp(56px, 6vw, 88px) 0 clamp(40px, 4vw, 56px); }
  .hero__inner {
    display: grid;
    grid-template-columns: minmax(150px, 170px) 1fr;
    align-items: center;
    gap: 48px;
    text-align: left;
    background: var(--bg-soft);
    border-radius: var(--radius-lg);
    padding: 44px 48px;
    box-shadow: var(--shadow-sm);
  }
  .hero__avatar {
    width: 128px;
    height: 128px;
    justify-self: center;
  }
  .hero__hello { font-size: 1.08rem; }
  .hero__name { font-size: clamp(2.2rem, 3.4vw, 2.8rem); }
  .hero__tagline { font-size: 1.1rem; max-width: 36em; }

  /* Section heading — slightly larger on desktop */
  .section-heading { font-size: clamp(1.6rem, 2.4vw, 1.9rem); }

  /* About — keep readable line length, single column but wider page feels balanced */
  .about__bio p { max-width: 70ch; font-size: 1.02rem; }

  /* Recent — 4-col compact cards */
  .recent__list { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .recent__item { padding: 16px 18px; }
  .recent__label { font-size: .78rem; }
  .recent__text { font-size: .94rem; line-height: 1.7; }

  /* Skills — 3-col category groups */
  .skills__grid { grid-template-columns: repeat(3, 1fr); gap: 28px 32px; }
  .skill-group { padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); }

  /* Works — 3-col grid */
  .work-grid { grid-template-columns: repeat(3, 1fr); gap: 28px; }
  .work-card__body { padding: 18px 20px 20px; }

  /* Note articles — 2-col grid */
  .note-articles__list { grid-template-columns: 1fr 1fr; gap: 16px; }
  .note-articles__link { padding: 16px 20px; }

  /* Links — 3-col horizontal */
  .links__list { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .links__item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .links__service { font-size: 1rem; }

  /* Footer — 3-col: copyright / privacy / trademark */
  .site-footer__inner {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1.6fr;
    gap: 24px 40px;
    text-align: left;
    align-items: start;
  }
  .site-footer__copy,
  .site-footer__privacy,
  .site-footer__tm { margin-bottom: 0; }
}

/* ============================================================
 * Wide desktop (>=1440px) — more breathing room, same structure.
 * ============================================================ */
@media (min-width: 1440px) {
  .hero__inner { padding: 56px 64px; gap: 64px; }
  .hero__avatar { width: 140px; height: 140px; }
  .work-grid { gap: 32px; }
  .recent__list { gap: 24px; }
}

/* ============================================================
 * これまで (history) — long-form readable narrative section.
 * Centered readable column, comfortable paragraph rhythm,
 * sub-headings consistent with the page. Identical in a/b/c.
 * ============================================================ */
.history__body {
  max-width: 70ch;
  margin: 0 auto;
}
.history__lead {
  color: var(--text-soft);
  margin-bottom: 1.6em;
}
.history__sub {
  margin: 1.8em 0 .6em;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  position: relative;
  padding-left: 16px;
}
.history__sub::before {
  content: "";
  position: absolute;
  left: 0; top: .3em;
  width: 6px; height: .9em;
  background: var(--accent-cool);
  border-radius: var(--radius-pill);
}
.history__sub:first-of-type { margin-top: 0; }
.history__body p {
  color: var(--text-soft);
  margin-bottom: 1.1em;
  line-height: 1.85;
}
.history__body p:last-child { margin-bottom: 0; }
@media (min-width: 1024px) {
  .history__sub { font-size: 1.15rem; }
  .history__body p { font-size: 1.02rem; }
}
