/* ============================================================
   portfolio.seeda.fun — phosphor terminal theme
   ============================================================ */

:root {
  --bg: #0a0f0b;
  --bg-panel: #0d1410;
  --bg-deep: #070b08;
  --border: #1d2b20;
  --border-bright: #2e4433;
  --text: #cfdcd0;
  --text-dim: #7c8f80;
  --green: #4ade80;
  --green-soft: #86efac;
  --green-glow: rgba(74, 222, 128, 0.35);
  --amber: #fbbf24;
  --red: #f87171;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --maxw: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(34, 78, 48, 0.28), transparent 60%),
    radial-gradient(900px 600px at 110% 15%, rgba(28, 60, 40, 0.18), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

/* 静止スキャンライン（低opacity・アニメなし） */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.028) 0px,
    rgba(255, 255, 255, 0.028) 1px,
    transparent 1px,
    transparent 3px
  );
}

::selection {
  background: var(--green);
  color: var(--bg-deep);
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

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

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.site {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 0;
}

/* ---------- 共通パーツ ---------- */

.prompt {
  color: var(--green);
  text-shadow: 0 0 8px var(--green-glow);
}

.term-line {
  margin: 0;
  color: var(--text-dim);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 2px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.section {
  margin-top: clamp(4rem, 9vw, 6.5rem);
}

.cmd-heading {
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 1.4rem;
}

.cmd-heading .flag {
  color: var(--amber);
  font-weight: 400;
}

/* ---------- hero: ターミナルウィンドウ ---------- */

.term-window {
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(20, 32, 24, 0.6), rgba(10, 16, 12, 0.9)), var(--bg-panel);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(74, 222, 128, 0.05);
  overflow: hidden;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red {
  background: var(--red);
}

.dot-amber {
  background: var(--amber);
}

.dot-green {
  background: var(--green);
}

.term-title {
  margin-left: 0.8rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.term-body {
  padding: clamp(1.5rem, 4vw, 2.6rem);
}

.hero-name {
  margin: 0.6rem 0 0.2rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e9f2ea;
  text-shadow: 0 0 24px rgba(74, 222, 128, 0.18);
}

.hero-tagline {
  margin: 0 0 1.6rem;
  color: var(--green-soft);
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
}

.term-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  margin-bottom: 1.6rem;
}

.term-nav a {
  color: var(--text);
  border-bottom: 1px dashed var(--border-bright);
  padding-bottom: 1px;
}

.term-nav a:hover {
  color: var(--green);
  border-bottom-color: var(--green);
  text-decoration: none;
}

/* タイプ演出（JS有効時のみ）: main.js が pre-reveal → revealed を付ける */
.typed-target > * {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.typed-target.pre-reveal > * {
  opacity: 0;
  transform: translateY(8px);
}

.typed-target.pre-reveal.revealed > * {
  opacity: 1;
  transform: none;
}

.typed-target.pre-reveal.revealed > *:nth-child(2) {
  transition-delay: 0.18s;
}

.typed-target.pre-reveal.revealed > *:nth-child(3) {
  transition-delay: 0.36s;
}

/* ---------- works ---------- */

.filter-bar {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

html.js .filter-bar {
  display: flex;
}

.filter-bar button {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-bar button:hover {
  border-color: var(--border-bright);
  color: var(--text);
}

.filter-bar button[aria-pressed="true"] {
  color: var(--green);
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.08);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.12);
}

.count-line {
  margin: 0 0 1.4rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  grid-auto-flow: dense;
  gap: 1.3rem;
}

.work-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.work-card:hover {
  border-color: var(--green);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(74, 222, 128, 0.1);
}

@media (min-width: 720px) {
  .work-card.featured {
    grid-column: span 2;
  }
}

.work-thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
}

/* スクショ未設定の間は帯状に抑えて空白を減らす */
.work-thumb.no-image {
  aspect-ratio: auto;
  height: 104px;
}

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

.thumb-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background:
    linear-gradient(135deg, transparent 48%, rgba(74, 222, 128, 0.05) 48%, rgba(74, 222, 128, 0.05) 52%, transparent 52%),
    var(--bg-deep);
}

.thumb-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.thumb-slug {
  color: var(--green);
  opacity: 0.55;
  font-size: 0.8rem;
}

.work-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.1rem 1.2rem 1.2rem;
  gap: 0.55rem;
}

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.work-title {
  margin: 0;
  font-size: 1.12rem;
  color: #e9f2ea;
}

.status {
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-live {
  color: var(--green);
}

.status-wip {
  color: var(--amber);
}

.status-archived {
  color: var(--text-dim);
}

.work-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.75;
}

.work-tech {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.work-tags {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  color: var(--green-soft);
  font-size: 0.78rem;
  opacity: 0.85;
}

.work-detail {
  border-top: 1px dashed var(--border);
  padding-top: 0.55rem;
  font-size: 0.85rem;
}

.work-detail summary {
  cursor: pointer;
  color: var(--text-dim);
  list-style: none;
}

.work-detail summary::-webkit-details-marker {
  display: none;
}

.work-detail summary::before {
  content: "▸ ";
  color: var(--green);
}

.work-detail[open] summary::before {
  content: "▾ ";
}

.work-detail summary:hover {
  color: var(--text);
}

.work-detail p {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  line-height: 1.75;
}

.work-link {
  margin-top: auto;
  padding-top: 0.3rem;
  font-size: 0.85rem;
}

/* ---------- writing (Zenn) ---------- */

.zenn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
}

.zenn-list li + li {
  border-top: 1px solid var(--border);
}

.zenn-list a {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 1.1rem;
  padding: 0.8rem 1.2rem;
  color: var(--text);
  transition: background 0.15s ease;
}

.zenn-list a:hover {
  background: rgba(74, 222, 128, 0.05);
  text-decoration: none;
}

.zenn-list a:hover .zenn-title {
  color: var(--green);
}

.zenn-perm {
  color: var(--text-dim);
  opacity: 0.6;
  font-size: 0.8rem;
}

.zenn-list time {
  color: var(--amber);
  font-size: 0.8rem;
  white-space: nowrap;
}

.zenn-title {
  font-size: 0.92rem;
  line-height: 1.6;
}

.zenn-empty {
  color: var(--text-dim);
}

.more-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .zenn-perm {
    display: none;
  }

  .zenn-list a {
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
  }
}

/* ---------- about ---------- */

.about-body {
  border-left: 2px solid var(--border-bright);
  padding-left: clamp(1rem, 3vw, 1.6rem);
  max-width: 46rem;
}

.about-heading {
  color: var(--green);
  font-weight: 600;
  margin: 0 0 0.8rem;
}

.about-body p {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
}

.link-list {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.link-list a {
  font-size: 0.92rem;
}

/* ---------- footer ---------- */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 5rem) clamp(1rem, 4vw, 2rem) 2.5rem;
}

.footer-note {
  margin: 0.3rem 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ---------- 404 ---------- */

.notfound {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
}

.nf-error {
  margin: 0;
  color: var(--red);
  font-size: clamp(1rem, 3vw, 1.3rem);
}

/* ---------- motion 配慮 ---------- */

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

  .cursor {
    animation: none;
  }

  .typed-target > *,
  .work-card,
  .filter-bar button,
  .zenn-list a {
    transition: none;
  }

  .work-card:hover {
    transform: none;
  }
}
