/* ==========================================================================
   Aloysius Raymond Lianto — Portfolio v2 (Unified Static Stylesheet)
   Calm, high-contrast, mobile-first, accessible, subtle v0 scroll motion.
   ========================================================================== */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --surface-tint: #eff6ff;
  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #4b5563;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #dbeafe;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 6px 20px rgba(17, 24, 39, 0.06);
  --container-max: 860px;
  --header-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  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;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--text);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   Header & Navigation Tabs
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: var(--header-height);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.site-nav {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.tab-list {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tab-button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.tab-button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.tab-button[aria-selected="true"] {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Main & Panels
   ========================================================================== */

.site-main {
  flex: 1 0 auto;
  position: relative;
}

.tab-panel {
  position: relative;
  padding: 2.5rem 0 4rem;
}

.tab-panel[hidden] {
  display: none;
}

/* Subtle v0 Hero Parallax Backdrop (CSS scroll-driven when supported) */
.hero-backdrop {
  position: absolute;
  inset: 0 0 auto 0;
  height: 360px;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 25%, rgba(29, 78, 216, 0.06), transparent 55%),
    radial-gradient(circle at 82% 20%, rgba(17, 24, 39, 0.04), transparent 50%);
  z-index: 0;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes subtle-parallax {
      from {
        transform: translate3d(0, 0, 0);
      }
      to {
        transform: translate3d(0, 48px, 0);
      }
    }

    .hero-backdrop {
      animation: subtle-parallax linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 420px;
      will-change: transform;
    }
  }
}

.home-container {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

/* ==========================================================================
   Tab 1: Minimal Home Hero & Chat
   ========================================================================== */

.hero-block {
  padding: 1.5rem 0 2rem;
}

.hero-header-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.headshot-slot {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1.5px dashed var(--border-strong);
  background: var(--surface);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  overflow: hidden;
}

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

.headshot-slot.has-photo {
  border-style: solid;
  border-color: var(--border);
}

.headshot-initials {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.1;
}

.headshot-caption {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 2px;
}

.hero-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-prompt-line {
  margin: 0.4rem 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 500;
  color: var(--accent);
}

.hero-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.72rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-sm {
  font-size: 0.84rem;
  padding: 0.5rem 0.85rem;
}

.btn-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--accent-hover);
}

/* Chat Card */
.chat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.chip-btn:hover {
  background: var(--surface-tint);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.15rem;
}

.chat-messages:empty {
  margin-bottom: 0;
}

.chat-msg {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chat-msg-user {
  align-self: flex-end;
  max-width: 85%;
  background: var(--text);
  color: #ffffff;
}

.chat-msg-assistant {
  align-self: flex-start;
  width: 100%;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.chat-msg-assistant p {
  margin: 0;
}

.chat-msg-assistant p + p {
  margin-top: 0.55rem;
}

.chat-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chat-form {
  display: flex;
  gap: 0.6rem;
}

.chat-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.96rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.9rem;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.chat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chat-disclaimer {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Content Tabs (Journey, Playground, Games, Music)
   ========================================================================== */

.content-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.page-intro {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-lead {
  margin: 0.6rem 0 0;
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 68ch;
}

.content-section {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.section-heading {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.45rem;
  box-shadow: var(--shadow-sm);
}

.card-muted {
  background: var(--surface-muted);
  border-style: dashed;
  border-color: var(--border-strong);
  box-shadow: none;
}

.card-teaser {
  background: linear-gradient(180deg, var(--surface-tint) 0%, var(--surface) 44%);
  border: 1px solid var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.teaser-tag {
  margin-bottom: 0.65rem;
}

/* Music Embed */
.playlist-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.music-embed-wrap {
  margin-top: 1.15rem;
  width: 100%;
  max-width: 660px;
}

.music-embed-frame {
  display: block;
  width: 100%;
  height: 450px;
  border: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
}

.card-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-meta {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.card-body {
  margin: 0.75rem 0 0;
  color: var(--text-secondary);
}

.card-list {
  margin: 0.85rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.role-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-accent {
  background: var(--surface-tint);
  color: var(--accent-hover);
  border-color: var(--accent-soft);
}

/* Case Studies Grid */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

.case-dl {
  margin: 0.85rem 0 0;
  display: grid;
  gap: 0.65rem;
}

.case-dl dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.case-dl dd {
  margin: 0.15rem 0 0;
  color: var(--text-secondary);
}

/* Skills Split */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

.skill-group + .skill-group {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.skill-group-label {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.skill-group-items {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

/* Placeholder note */
.tbd-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Subtle Scroll Reveal (Progressive Enhancement + Reduced Motion Safe)
   ========================================================================== */

.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease-out, transform 420ms ease-out;
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .reveal-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   Persistent Contact Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.6rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.footer-identity {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-name {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--text);
}

.footer-location {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  font-size: 0.92rem;
}

.copy-status {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (min-width: 720px) {
  .skills-grid {
    grid-template-columns: 1.35fr 1fr;
  }

  .cards-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .tab-panel {
    padding: 1.65rem 0 3rem;
  }

  .hero-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .chat-card {
    padding: 1rem;
  }

  .chat-form {
    flex-direction: column;
  }

  .chat-submit {
    width: 100%;
  }

  .card {
    padding: 1.15rem;
  }
}
