/* ==========================================================================
   VideoNext ポートフォリオ — レイアウト & コンポーネント
   依存: styles/colors_and_type.css（先に読み込むこと）
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 240ms var(--ease-standard), color 240ms var(--ease-standard);
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ----- Theme: dark override ------------------------------------------- */
body[data-theme="dark"] {
  --bg-1: #0B0A09;
  --bg-2: #16140F;
  --bg-3: #1F1E1C;
  --fg-1: #F6F4EF;
  --fg-2: rgba(246,244,239,.74);
  --fg-3: rgba(246,244,239,.5);
  --fg-4: rgba(246,244,239,.35);
  --border-1: rgba(255,255,255,.08);
  --border-2: rgba(255,255,255,.14);
  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 8px 24px rgba(0,0,0,.45);
  --shadow-3: 0 24px 60px rgba(0,0,0,.55);
}

/* ----- Layout primitives ---------------------------------------------- */
.container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--fg-3);
}

/* ----- Top nav --------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  height: 72px;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  background: color-mix(in srgb, var(--bg-1) 78%, transparent);
  border-bottom: 1px solid var(--border-1);
}
.nav-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.nav-logo { display: flex; align-items: center; gap: 12px; }
.nav-logo img { height: 22px; }
.nav-divider {
  width: 1px; height: 18px; background: var(--border-2); opacity: .8;
}
.nav-tag {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-2);
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--fg-2);
  transition: color 160ms var(--ease-standard);
}
.nav-links a:hover { color: var(--fg-1); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 14px; line-height: 1;
  padding: 13px 22px; border-radius: 999px; border: 0;
  cursor: pointer; white-space: nowrap;
  transition: background 180ms var(--ease-standard), transform 120ms var(--ease-standard);
}
.btn:active { transform: scale(.98); }
.btn-ink { background: var(--color-ink); color: #fff; }
.btn-ink:hover { background: #2A2825; }
body[data-theme="dark"] .btn-ink { background: var(--color-bone); color: var(--color-ink); }
body[data-theme="dark"] .btn-ink:hover { background: #fff; }
.btn .arrow { transition: transform 220ms var(--ease-standard); }
.btn:hover .arrow { transform: translateX(3px); }

/* ----- Hero ------------------------------------------------------------ */
.hero {
  padding: 56px 0 64px;
  position: relative;
  overflow: hidden;
}

/* Video background variant: dark cinematic hero with looping bg video. */
.hero.hero-video {
  padding: 88px 0 96px;
  background: #0B0A09;
  color: #fff;
  margin-top: -72px; /* tuck under the translucent nav so video reaches the top edge */
  padding-top: 160px; /* compensate for nav overlap */
}
.hero-bg {
  position: absolute; inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-bg video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(.85) contrast(1.05);
}
.hero-bg-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,10,9,.55) 0%, rgba(11,10,9,.7) 60%, rgba(11,10,9,.95) 100%),
    radial-gradient(circle at 80% 30%, rgba(27,91,255,.22), transparent 55%);
}
.hero.hero-video .container { position: relative; z-index: 1; }
.hero.hero-video h1 { color: #fff; }
.hero.hero-video h1 em { color: #6E96FF; }
.hero.hero-video .hero-lead { color: rgba(255,255,255,.82); }
.hero.hero-video .eyebrow { color: rgba(255,255,255,.65); }

.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 80px; align-items: center; min-height: 260px; }
.hero.hero-video .hero-inner { grid-template-columns: 1fr; }
.hero-eyebrow-row {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.hero-eyebrow-row .dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 22%, transparent);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.6vw, 60px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  color: var(--fg-1);
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--color-accent);
  font-feature-settings: "tnum";
}
.hero-lead {
  font-family: var(--font-jp);
  font-size: 17px; line-height: 1.85;
  color: var(--fg-2);
  max-width: 480px;
  margin: 0;
}
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  border-top: 1px solid var(--border-1);
  padding-top: 32px;
}
.hero-stat-num {
  font-family: var(--font-display);
  font-size: clamp(40px, 4.6vw, 64px);
  font-weight: 800; letter-spacing: -0.02em;
  line-height: 1;
  color: var(--fg-1);
  font-feature-settings: "tnum";
}
.hero-stat-num small { font-size: .42em; font-weight: 700; margin-left: 4px; color: var(--fg-3); }
.hero-stat-label {
  margin-top: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-3);
}

/* ----- Hero side card (featured-ish floating chip stack) -------------- */
.hero-floats {
  position: relative;
  height: 100%;
  min-height: 220px;
}
.hero-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-2);
  font-size: 13px; font-weight: 500; color: var(--fg-1);
  position: absolute;
  animation: float-y 6s ease-in-out infinite;
}
.hero-chip .swatch {
  width: 8px; height: 8px; border-radius: 999px;
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ----- Category section ----------------------------------------------- */
.tabs-wrap {
  position: sticky; top: 72px; z-index: 30;
  background: color-mix(in srgb, var(--bg-1) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-1);
}
.tabs {
  display: flex; gap: 4px; padding: 14px 0;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-size: 14px; font-weight: 600;
  color: var(--fg-2);
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: transparent;
  cursor: pointer; white-space: nowrap;
  transition: all 160ms var(--ease-standard);
}
.tab .count { font-size: 11px; opacity: .6; font-weight: 500; }
.tab:hover { color: var(--fg-1); border-color: var(--border-2); }
.tab.active {
  background: var(--color-ink);
  color: #fff;
  border-color: var(--color-ink);
}
body[data-theme="dark"] .tab.active {
  background: var(--color-bone);
  color: var(--color-ink);
  border-color: var(--color-bone);
}
.tab.active .count { opacity: .65; }

/* ----- Grid section --------------------------------------------------- */
.section { padding: 48px 0 120px; }
.cat-block { padding-top: 16px; }
.cat-block + .cat-block { padding-top: 80px; }
.cat-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-1);
}
.cat-head h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 40px); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1;
  color: var(--fg-1);
}
.cat-head .cat-en {
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 600;
}
.cat-head .cat-desc {
  font-family: var(--font-jp);
  font-size: 14px; line-height: 1.75;
  color: var(--fg-2); max-width: 420px; margin: 0;
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px 28px;
}
@media (max-width: 980px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

/* Masonry layout (variable aspect ratios) */
.grid.masonry {
  grid-auto-flow: row;
}
.grid.masonry .card:nth-child(4n+1) .thumb { aspect-ratio: 4 / 3; }
.grid.masonry .card:nth-child(4n+2) .thumb { aspect-ratio: 16 / 9; }
.grid.masonry .card:nth-child(4n+3) .thumb { aspect-ratio: 16 / 11; }
.grid.masonry .card:nth-child(4n+4) .thumb { aspect-ratio: 1 / 1; }

/* ----- Video card ----------------------------------------------------- */
.card {
  cursor: pointer;
  display: flex; flex-direction: column;
  gap: 16px;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  transition: transform 220ms var(--ease-standard);
}
.card:hover { transform: translateY(-3px); }

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-1);
  transition: box-shadow 220ms var(--ease-standard), border-color 220ms var(--ease-standard);
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 480ms var(--ease-standard);
}
.card:hover .thumb { box-shadow: var(--shadow-3); border-color: var(--border-2); }
.card:hover .thumb img { transform: scale(1.04); }
.thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(16,15,13,.55) 100%);
  pointer-events: none;
  opacity: .9;
}

.thumb-duration {
  position: absolute; bottom: 12px; right: 12px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(16,15,13,.78);
  color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  font-family: var(--font-mono);
}

.thumb-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.94);
  z-index: 2;
  width: 60px; height: 60px;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 200ms var(--ease-standard), transform 220ms var(--ease-standard);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.thumb-play svg { width: 22px; height: 22px; fill: var(--color-ink); margin-left: 3px; }
.card:hover .thumb-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.card-tag {
  position: absolute; top: 12px; left: 12px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: var(--color-ink);
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-body { padding: 0 4px; }
.card-meta-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--fg-3); font-weight: 500;
  margin-bottom: 8px;
}
.card-meta-row .sep {
  width: 3px; height: 3px; border-radius: 999px;
  background: var(--border-2);
}
.card-title {
  font-family: var(--font-jp);
  font-size: 17px; font-weight: 700;
  line-height: 1.5; letter-spacing: 0.005em;
  color: var(--fg-1);
  margin: 0 0 8px;
  text-wrap: pretty;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-purpose {
  font-family: var(--font-jp);
  font-size: 13px; line-height: 1.7;
  color: var(--fg-2);
  margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags span {
  font-size: 11px; font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--border-1);
}

/* ----- Modal ---------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11,10,9,.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding: 32px;
  animation: modal-in 220ms var(--ease-standard);
}
@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  width: 100%; max-width: 1080px;
  margin: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-4, 0 32px 80px rgba(0,0,0,.5));
  animation: modal-rise 280ms var(--ease-standard);
}
@keyframes modal-rise {
  from { transform: translateY(20px) scale(.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-video {
  position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  background: #000;
}
.modal-video video {
  width: 100%; height: 100%; object-fit: contain;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  z-index: 5;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 0;
  transition: background 180ms var(--ease-standard);
}
.modal-close:hover { background: rgba(0,0,0,.85); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 32px; }
.modal-cat {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent-press);
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
body[data-theme="dark"] .modal-cat {
  background: rgba(27,91,255,.18);
  color: #8FB0FF;
}
.modal h2 {
  font-family: var(--font-jp);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800; line-height: 1.4;
  letter-spacing: -0.005em;
  margin: 0 0 20px;
  color: var(--fg-1);
}
.modal-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px 32px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border-1);
}
.modal-meta-row { display: flex; flex-direction: column; gap: 4px; }
.modal-meta-row .label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-3);
}
.modal-meta-row .value {
  font-family: var(--font-jp);
  font-size: 14px; line-height: 1.6;
  color: var(--fg-1);
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.modal-tags span {
  font-size: 11px; padding: 3px 9px; border-radius: 6px;
  background: var(--bg-3); color: var(--fg-2);
  border: 1px solid var(--border-1);
}

/* ----- Footer --------------------------------------------------------- */
.footer {
  background: var(--color-ink);
  color: rgba(255,255,255,.7);
  padding: 64px 0 40px;
}
.footer-inner {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 48px; align-items: start;
}
.footer img.logo { height: 22px; margin-bottom: 18px; }
.footer p {
  font-family: var(--font-jp);
  font-size: 13px; line-height: 1.8;
  color: rgba(255,255,255,.6);
  max-width: 460px;
  margin: 0;
}
.footer-cta {
  display: flex; flex-direction: column; gap: 12px;
  padding: 24px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.footer-cta .label {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,.5); font-weight: 600;
}
.footer-cta a {
  font-size: 20px; font-weight: 700; color: #fff;
  display: inline-flex; align-items: center; gap: 10px;
}
.footer-cta a:hover { color: #fff; }
.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(255,255,255,.45);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ----- Responsive ----------------------------------------------------- */
@media (max-width: 900px) {
  .hero { padding: 40px 0 48px; }
  .hero-inner { grid-template-columns: 1fr; gap: 32px; min-height: 0; }
  .hero-floats { display: none; }
  .cat-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-inner { grid-template-columns: 1fr; }
  .modal-meta { grid-template-columns: 1fr; }
  .modal-body { padding: 24px; }
}
@media (max-width: 560px) {
  .container { padding: 0 20px; }
  .nav-links { display: none; }
}
