/* ==========================================================================
   global.css — Design System
   響(Hibiki) Portfolio — hibikishimizu.com
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Import
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   2. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Colors — Base */
  --c-bg:       #080808;
  --c-bg-2:     #0f0f0f;
  --c-bg-3:     #181818;
  --c-bg-4:     #222222;
  --c-border:   rgba(255, 255, 255, 0.08);
  --c-border-2: rgba(255, 255, 255, 0.04);

  /* Colors — Text */
  --c-text:       #f0f0f0;
  --c-text-muted: #888888;
  --c-text-faint: #444444;

  /* Colors — Accent */
  --c-accent:   #ff6b35;
  --c-accent-2: #7c3aed;

  /* Gradient — accent text / highlights */
  --grad-warm:   linear-gradient(135deg, #ff6b35 0%, #f7931e 40%, #ffcd3c 100%);
  --grad-full:   linear-gradient(135deg, #ff6b35 0%, #f7931e 20%, #ffcd3c 40%, #84cc16 60%, #3b82f6 80%, #8b5cf6 100%);
  --grad-cool:   linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --grad-subtle: linear-gradient(135deg, rgba(255,107,53,0.1) 0%, rgba(139,92,246,0.1) 100%);

  /* Glass Morphism */
  --glass-bg:     rgba(255, 255, 255, 0.03);
  --glass-bg-2:   rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur:   blur(20px) saturate(180%);

  /* Typography */
  --font-ja: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Font Sizes — fluid type scale */
  --fs-xs:  clamp(10px, 1.1vw, 12px);
  --fs-sm:  clamp(12px, 1.3vw, 14px);
  --fs-md:  clamp(14px, 1.6vw, 16px);
  --fs-lg:  clamp(16px, 2vw, 20px);
  --fs-xl:  clamp(20px, 3vw, 28px);
  --fs-2xl: clamp(28px, 4.5vw, 48px);
  --fs-3xl: clamp(40px, 7vw, 80px);
  --fs-4xl: clamp(56px, 10vw, 120px);

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;
  --space-10: 128px;

  /* Layout */
  --container-max:     1200px;
  --container-wide:    1440px;
  --container-padding: clamp(24px, 5vw, 80px);
  --section-padding:   clamp(80px, 10vw, 160px);

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --dur-fast:    150ms;
  --dur-mid:     300ms;
  --dur-slow:    600ms;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 0 40px rgba(255, 107, 53, 0.15);

  /* Nav */
  --nav-height: 64px;
}

/* --------------------------------------------------------------------------
   3. CSS Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ja);
  font-size: var(--fs-md);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* --------------------------------------------------------------------------
   4. Accessibility
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
}

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

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 100000;
  padding: 8px 16px;
  background: var(--c-accent);
  color: #fff;
  font-size: var(--fs-sm);
  border-radius: 4px;
  text-decoration: none;
}
.skip-link:focus {
  top: 16px;
}

/* --------------------------------------------------------------------------
   5. Typography Utilities
   -------------------------------------------------------------------------- */
.font-ja { font-family: var(--font-ja); }
.font-en { font-family: var(--font-en); }

.text-gradient {
  background: var(--grad-full);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-warm {
  background: var(--grad-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted  { color: var(--c-text-muted); }
.text-faint  { color: var(--c-text-faint); }
.text-accent { color: var(--c-accent); }

.label-sm {
  font-family: var(--font-en);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* --------------------------------------------------------------------------
   6. Layout Utilities
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--wide {
  max-width: var(--container-wide);
}

.section-pad {
  padding-block: var(--section-padding);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* --------------------------------------------------------------------------
   7. Navigation
   -------------------------------------------------------------------------- */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--container-padding);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  transition: transform var(--dur-mid) var(--ease-smooth),
              background var(--dur-mid) var(--ease-smooth);
}

#main-nav.nav-scrolled {
  background: rgba(8, 8, 8, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

#main-nav.nav-hidden {
  transform: translateY(-100%);
}

.nav-logo {
  font-family: var(--font-ja);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  padding-bottom: 0.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

@media (max-width: 768px) {
  .nav-logo {
    font-size: 13px;
    max-width: 200px;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-7);
}

.nav-links a {
  font-family: var(--font-en);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-muted);
  letter-spacing: 0.03em;
  transition: color var(--dur-fast) var(--ease-smooth);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grad-warm);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-mid) var(--ease-smooth);
}

/* Suppress all nav link transitions during initial active-state setup */
.nav-no-transition .nav-links a,
.nav-no-transition .nav-links a::after {
  transition: none !important;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--c-text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-lang,
.footer-lang {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  opacity: 0.4;
  transition: opacity var(--dur-fast) var(--ease-smooth),
              background var(--dur-fast) var(--ease-smooth);
}

.lang-btn:hover {
  opacity: 0.8;
  background: var(--glass-bg-2);
}

.lang-btn.active {
  opacity: 1;
}

.lang-divider {
  color: var(--c-text-faint);
  font-size: var(--fs-xs);
  margin-inline: 2px;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: rgba(8, 8, 8, 0.92);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 2px 8px rgba(0,0,0,0.6);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.nav-hamburger:hover {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px var(--c-accent), 0 2px 8px rgba(0,0,0,0.6);
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
  transition: all var(--dur-mid) var(--ease-smooth);
}

/* --------------------------------------------------------------------------
   8. Mobile Nav
   -------------------------------------------------------------------------- */
/* PC でデフォルト非表示 — JS で注入されるモバイル専用要素 */
.lang-select-mobile { display: none; }
.nav-close-btn      { display: none; }
.nav-lang-item      { display: none; } /* li wrapper — must be none so it doesn't add flex gap on desktop */

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(8, 8, 8, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-7);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: var(--fs-xl);
  }

  /* Hamburger: right-aligned, hide nav-lang from top bar */
  .nav-hamburger {
    display: flex;
    margin-left: auto;
  }

  .nav-lang {
    display: none;
  }

  /* X close button inside overlay */
  .nav-close-btn {
    display: flex;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: var(--c-text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast);
    flex-shrink: 0;
  }

  .nav-close-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
  }

  /* Show li wrapper for mobile lang select */
  .nav-lang-item { display: list-item; }

  /* Mobile lang select */
  .lang-select-mobile {
    display: block;
    margin-top: var(--space-2);
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-full);
    color: var(--c-text);
    font-size: var(--fs-md);
    font-family: var(--font-en);
    cursor: pointer;
    text-align: center;
    min-width: 160px;
  }

  .lang-select-mobile:focus {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
  }
}

/* --------------------------------------------------------------------------
   9. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-en);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all var(--dur-mid) var(--ease-smooth);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--grad-warm);
  color: #000;
  box-shadow: 0 2px 12px rgba(255, 107, 53, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.45), 0 0 0 1px rgba(255, 107, 53, 0.2);
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
  filter: brightness(0.95);
}

.btn-ghost {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  color: var(--c-text);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--glass-bg-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-ghost:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon {
  padding: 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: all var(--dur-mid) var(--ease-smooth);
}

.btn-icon:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--glass-bg-2);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   10. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--dur-mid) var(--ease-smooth),
              transform var(--dur-mid) var(--ease-smooth),
              box-shadow var(--dur-mid) var(--ease-smooth);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* Tech badge */
.tech-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-en);
  font-size: var(--fs-xs);
  font-weight: 500;
  background: var(--c-bg-3);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   11. Section Header Pattern
   -------------------------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-9);
}

.section-num {
  font-family: var(--font-en);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--c-accent);
  letter-spacing: 0.05em;
}

.section-title {
  font-family: var(--font-en);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-title-ja {
  font-size: var(--fs-lg);
  color: var(--c-text-muted);
  margin-left: var(--space-3);
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   12. Cookie Banner
   -------------------------------------------------------------------------- */
#cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 480px;
  z-index: 2000;
  background: var(--c-bg-3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-lg);
  transform: translateY(calc(100% + 24px));
  transition: transform var(--dur-slow) var(--ease-spring);
}

#cookie-banner.visible {
  transform: translateY(0);
}

#cookie-banner.hidden {
  display: none;
}

.cookie-text {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.cookie-text a {
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.cookie-close {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--c-bg-4);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.cookie-close:hover {
  background: var(--c-text-faint);
}

/* --------------------------------------------------------------------------
   13. Author Badge (shared footer signature)
   -------------------------------------------------------------------------- */
.author-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  transition: all var(--dur-mid) var(--ease-smooth);
}

.author-badge:hover {
  color: var(--c-text);
  border-color: rgba(255, 255, 255, 0.15);
}

.author-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding-block: var(--space-9) var(--space-7);
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: var(--grad-warm);
  opacity: 0.5;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: start;
  gap: var(--space-7);
}

.footer-logo {
  font-family: var(--font-ja);
  font-size: 18px;
  font-weight: 700;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-bottom: 0.15em;
}

.footer-links {
  display: flex;
  gap: var(--space-5);
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  transition: color var(--dur-fast);
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--c-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-mid) var(--ease-smooth);
}

.footer-links a:hover {
  color: var(--c-text);
}

.footer-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.footer-copy {
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
  font-family: var(--font-en);
}

/* --------------------------------------------------------------------------
   15. Scroll Animations (GSAP targets — initial state)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
}

/* --------------------------------------------------------------------------
   16. Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--c-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--c-bg-4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c-text-faint);
}

/* --------------------------------------------------------------------------
   17. Selection
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(255, 107, 53, 0.25);
  color: var(--c-text);
}

/* --------------------------------------------------------------------------
   18. Noise Texture Overlay (for hero)
   -------------------------------------------------------------------------- */
.noise-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

/* --------------------------------------------------------------------------
   19. Utility Classes
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.inset-0 { inset: 0; }
.z-10 { z-index: 10; }
.pointer-none { pointer-events: none; }

/* --------------------------------------------------------------------------
   Content Protection
   -------------------------------------------------------------------------- */
/* Disable text selection site-wide */
* {
  user-select: none;
  -webkit-user-select: none;
}

/* Disable image drag, right-click save, and mobile long-press save */
img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}
