/* ──────────────────────────────────────────────
   Portfolio — Styles
   ────────────────────────────────────────────── */

:root {
  --ink: #1a1a1a;
  --parchment: #f5f0e8;
  --sakura: #e8a0b4;
  --sakura-deep: #c77a90;
  --bamboo: #7a9e7e;
  --bamboo-dark: #4a6b4e;
  --water: #6b8fa3;
  --water-light: #a3c4d4;
  --stone: #8a8578;
  --gold: #c4a35a;
  --fog: rgba(245, 240, 232, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--ink);
  color: var(--parchment);
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
  cursor: none;
}

/* ── Custom cursor ── */
.cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--sakura);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.15s ease, border-color 0.3s;
  mix-blend-mode: difference;
}
.cursor.hover {
  transform: scale(2.2);
  border-color: var(--gold);
}
.cursor-dot {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--sakura);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  transition: background 0.3s;
}

/* ── Three.js Canvas ── */
#scene-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

/* ── Fog overlay ── */
.fog-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(107,143,163,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(232,160,180,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* ── Top bar (header) ── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 28px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  opacity: 0;
  animation: fadeSlideDown 1.2s ease 1.5s forwards;
}

.logo {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  color: var(--parchment);
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo .kanji {
  font-size: 1.6rem;
  color: var(--sakura);
  opacity: 0.8;
}
.logo .separator {
  width: 24px;
  height: 1px;
  background: var(--sakura);
  opacity: 0.4;
}

/* ── Section indicator (nav) ── */
.section-indicator {
  position: fixed;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  animation: fadeSlideLeft 1s ease 2s forwards;
  list-style: none;
}
.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245,240,232,0.3);
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  padding: 0;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.indicator-dot.active {
  background: var(--sakura);
  border-color: var(--sakura);
  box-shadow: 0 0 12px rgba(232,160,180,0.4);
}
.indicator-dot:hover {
  border-color: var(--sakura);
  transform: scale(1.5);
}
.indicator-dot .tooltip {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  color: var(--parchment);
  font-family: 'DM Sans', sans-serif;
}
.indicator-dot:hover .tooltip { opacity: 0.7; }

/* ── Focus visible ── */
.indicator-dot:focus-visible,
.hero-cta:focus-visible,
.contact-link:focus-visible,
.project-card:focus-visible {
  outline: 2px solid var(--sakura);
  outline-offset: 3px;
}

/* ── Central content panels ── */
.content-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 50;
  pointer-events: none;
}

.panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}
.panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Hero panel ── */
.hero-content {
  text-align: center;
  max-width: 700px;
  padding: 0 40px;
}
.hero-greeting {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--sakura);
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeIn 1s ease 2.2s forwards;
}
.hero-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  opacity: 0;
  animation: fadeSlideUp 1.2s ease 2.5s forwards;
}
.hero-name .accent {
  color: var(--sakura);
  font-style: italic;
}
.hero-role {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: rgba(245,240,232,0.5);
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeIn 1s ease 2.9s forwards;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  border: 1px solid rgba(232,160,180,0.3);
  color: var(--sakura);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  animation: fadeIn 1s ease 3.2s forwards;
  background: rgba(26,26,26,0.4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.hero-cta:hover {
  background: rgba(232,160,180,0.1);
  border-color: var(--sakura);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(232,160,180,0.15);
}
.hero-cta svg {
  width: 16px;
  transition: transform 0.4s;
}
.hero-cta:hover svg { transform: translateX(4px); }

/* ── About panel ── */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 60px;
  max-width: 900px;
  padding: 0 60px;
  align-items: start;
}
.about-divider {
  width: 1px;
  height: 200px;
  background: linear-gradient(to bottom, transparent, var(--sakura-deep), transparent);
  align-self: center;
}
.about-left h2 {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 2.2rem;
  margin-bottom: 8px;
  color: var(--parchment);
}
.about-left .kanji-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.75rem;
  color: var(--sakura);
  letter-spacing: 0.3em;
  margin-bottom: 28px;
}
.about-left p {
  font-weight: 300;
  font-size: 0.88rem;
  line-height: 1.9;
  color: rgba(245,240,232,0.65);
}
.about-right {
  padding-top: 10px;
}
.skill-group {
  margin-bottom: 28px;
}
.skill-label {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sakura);
  margin-bottom: 10px;
  opacity: 0.7;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-tag {
  padding: 5px 14px;
  border: 1px solid rgba(245,240,232,0.12);
  font-size: 0.75rem;
  color: rgba(245,240,232,0.55);
  letter-spacing: 0.05em;
  transition: all 0.3s;
  background: rgba(26,26,26,0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.skill-tag:hover {
  border-color: var(--sakura);
  color: var(--sakura);
}

/* ── Projects panel ── */
.projects-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  max-width: 1000px;
  padding: 0 60px;
  width: 100%;
}
.projects-header {
  text-align: center;
  margin-bottom: 10px;
}
.projects-header h2 {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 2rem;
  margin-bottom: 6px;
}
.projects-header .kanji-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.75rem;
  color: var(--sakura);
  letter-spacing: 0.3em;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}
.project-card {
  border: 1px solid rgba(245,240,232,0.08);
  padding: 30px 24px;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(26,26,26,0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--sakura), transparent);
  opacity: 0;
  transition: opacity 0.5s;
}
.project-card:hover::before { opacity: 1; }
.project-card:hover {
  border-color: rgba(232,160,180,0.2);
  transform: translateY(-5px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.project-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 300;
  color: rgba(245,240,232,0.06);
  margin-bottom: 14px;
  line-height: 1;
}
.project-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--parchment);
}
.project-tech {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sakura);
  opacity: 0.8;
  margin-bottom: 12px;
}
.project-card p {
  font-size: 0.8rem;
  line-height: 1.7;
  color: rgba(245,240,232,0.6);
  font-weight: 300;
}
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 18px;
  border: 1px solid rgba(232,160,180,0.25);
  color: var(--sakura);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  background: rgba(232,160,180,0.05);
}
.project-link:hover {
  background: rgba(232,160,180,0.12);
  border-color: var(--sakura);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232,160,180,0.15);
}
.project-link:focus-visible {
  outline: 2px solid var(--sakura);
  outline-offset: 3px;
}

/* ── Contact panel ── */
.contact-content {
  text-align: center;
  max-width: 600px;
  padding: 0 40px;
}
.contact-content h2 {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 2.5rem;
  margin-bottom: 6px;
}
.contact-content .kanji-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.75rem;
  color: var(--sakura);
  letter-spacing: 0.3em;
  margin-bottom: 24px;
}
.contact-content p {
  font-weight: 300;
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(245,240,232,0.55);
  margin-bottom: 36px;
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}
.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border: 1px solid rgba(245,240,232,0.1);
  color: rgba(245,240,232,0.7);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: all 0.4s;
  cursor: pointer;
  background: rgba(26,26,26,0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.contact-link:hover {
  border-color: var(--sakura);
  color: var(--sakura);
  transform: translateY(-2px);
}

/* ── Scroll hint ── */
.scroll-hint {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeIn 1s ease 3.6s forwards;
}
.scroll-hint span {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.5);
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--sakura), transparent);
  animation: scrollPulse 2s ease infinite;
}

/* ── Loading screen ── */
.loader {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--ink);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-kanji {
  font-family: 'Noto Serif JP', serif;
  font-size: 3rem;
  font-weight: 200;
  color: var(--sakura);
  animation: breathe 2s ease infinite;
}
.loader-text {
  margin-top: 20px;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.5);
}
.loader-bar {
  width: 120px;
  height: 1px;
  background: rgba(245,240,232,0.1);
  margin-top: 20px;
  position: relative;
  overflow: hidden;
}
.loader-bar::after {
  content: '';
  position: absolute;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--sakura);
  animation: loadBar 1.5s ease forwards;
}

/* ── Section counter ── */
.section-counter {
  position: fixed;
  bottom: 36px;
  left: 40px;
  z-index: 100;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  color: rgba(245,240,232,0.5);
  opacity: 0;
  animation: fadeIn 1s ease 3.5s forwards;
}
.section-counter .current {
  color: var(--sakura);
  font-size: 1.3rem;
}

/* ── Noscript fallback ── */
.noscript-fallback {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--parchment);
  font-family: 'DM Sans', sans-serif;
  text-align: center;
  padding: 40px;
}
.noscript-fallback h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 2rem;
  margin-bottom: 16px;
}
.noscript-fallback p {
  font-size: 0.9rem;
  color: rgba(245,240,232,0.6);
  line-height: 1.8;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(25px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideLeft {
  from { opacity: 0; transform: translate(15px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes loadBar {
  to { left: 100%; }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.1); }
}

/* ── Prefers reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body {
    cursor: auto;
  }

  .cursor,
  .cursor-dot {
    display: none;
  }

  .scroll-line {
    animation: none;
  }

  .panel {
    transition: opacity 0.2s ease;
    transform: none !important;
  }

  .panel.active {
    transform: none;
  }
}

/* ── Responsive: Tablet ── */
@media (max-width: 1024px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-content { padding: 0 40px; }
  .about-content { gap: 40px; padding: 0 40px; }
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
  .about-content { grid-template-columns: 1fr; gap: 30px; padding: 0 30px; }
  .about-divider { display: none; }
  .projects-grid { grid-template-columns: 1fr; }
  .projects-content { padding: 0 30px; }
  .top-bar { padding: 20px 24px; }
  .section-indicator { right: 20px; }
  .hero-name { font-size: 2.6rem; }
  .contact-links { flex-direction: column; align-items: center; }
}

/* ── Responsive: Small mobile ── */
@media (max-width: 480px) {
  .hero-content { padding: 0 24px; }
  .hero-name { font-size: 2.2rem; }
  .hero-role { font-size: 0.85rem; }
  .contact-content { padding: 0 24px; }
  .projects-content { padding: 0 20px; }
  .section-counter { left: 20px; }
}
