/* ==========================================================================
   KirsuLab — Material 3 Expressive
   Color system: Purple primary, custom tonal palette
   Typography: Roboto Flex (variable)
   ========================================================================== */

:root {
  /* ---------- M3 Color Tokens ---------- */
  --md-primary: #6750A4;
  --md-on-primary: #FFFFFF;
  --md-primary-container: #EADDFF;
  --md-on-primary-container: #21005D;

  --md-secondary: #625B71;
  --md-on-secondary: #FFFFFF;
  --md-secondary-container: #E8DEF8;
  --md-on-secondary-container: #1E192B;

  --md-tertiary: #7D5260;
  --md-on-tertiary: #FFFFFF;
  --md-tertiary-container: #FFD8E4;
  --md-on-tertiary-container: #31101D;

  --md-surface: #FEF7FF;
  --md-on-surface: #1D1B20;
  --md-on-surface-variant: #49454F;

  --md-surface-container-lowest: #FFFFFF;
  --md-surface-container-low: #F7F2FA;
  --md-surface-container: #F3EDF7;
  --md-surface-container-high: #ECE6F0;
  --md-surface-container-highest: #E6E0E9;

  --md-outline: #79747E;
  --md-outline-variant: #CAC4D0;

  /* ---------- Shape Tokens ---------- */
  --shape-xs: 8px;
  --shape-sm: 12px;
  --shape-md: 16px;
  --shape-lg: 24px;
  --shape-xl: 28px;
  --shape-xxl: 36px;
  --shape-full: 9999px;

  /* ---------- Spring Motion ---------- */
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  --max-width: 1280px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  font-family: 'Roboto Flex', system-ui, -apple-system, sans-serif;
  font-variation-settings: "wdth" 100, "opsz" 14, "GRAD" 0;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================================
   Top App Bar
   ========================================================================== */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(254, 247, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.app-bar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--md-on-surface);
}

.app-bar__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--shape-sm);
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: grid;
  place-items: center;
  font-family: 'Roboto Flex', sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1;
  font-variation-settings: "wdth" 100, "opsz" 32, "GRAD" 0;
  transition: transform 0.3s var(--ease-spring);
}

@media (hover: hover) {
  .app-bar__brand:hover .app-bar__logo {
    transform: rotate(-6deg) scale(1.05);
  }
}

.app-bar__name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.005em;
  font-variation-settings: "wdth" 100, "opsz" 20;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--shape-full);
  padding: 10px 20px;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.3s ease, transform 0.15s ease;
  user-select: none;
}

.btn .material-symbols-rounded {
  font-size: 18px;
}

.btn--filled {
  background: var(--md-primary);
  color: var(--md-on-primary);
}
@media (hover: hover) {
  .btn--filled:hover {
    background: #5B4593;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 8px rgba(103,80,164,0.25);
  }
}
.btn--filled:active { transform: scale(0.97); }

.btn--tonal {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}
@media (hover: hover) {
  .btn--tonal:hover {
    background: #DCCFEB;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  }
}
.btn--tonal:active { transform: scale(0.97); }

.btn--text {
  background: transparent;
  color: var(--md-primary);
}
@media (hover: hover) {
  .btn--text:hover {
    background: rgba(103, 80, 164, 0.08);
  }
}

.btn--lg {
  padding: 14px 26px;
  font-size: 15px;
}
.btn--lg .material-symbols-rounded { font-size: 20px; }

.btn--fab-extended {
  background: var(--md-primary);
  color: var(--md-on-primary);
  padding: 20px 28px;
  font-size: 16px;
  font-weight: 500;
  gap: 14px;
  border-radius: var(--shape-md);
  box-shadow: 0 3px 6px rgba(0,0,0,0.08), 0 6px 24px rgba(103,80,164,0.28);
  transition: all 0.3s var(--ease-spring);
}
.btn--fab-extended .material-symbols-rounded { font-size: 22px; }
@media (hover: hover) {
  .btn--fab-extended:hover {
    background: #5B4593;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1), 0 12px 36px rgba(103,80,164,0.35);
    transform: translateY(-2px);
  }
}
.btn--fab-extended:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 3px 12px rgba(103,80,164,0.25);
}

/* ==========================================================================
   Main Container
   ========================================================================== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  background: var(--md-surface-container-low);
  border-radius: var(--shape-xxl);
  padding: clamp(40px, 8vw, 96px);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--md-primary-container) 0%, transparent 70%);
  opacity: 0.55;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -200px;
  left: -180px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, var(--md-tertiary-container) 0%, transparent 70%);
  opacity: 0.45;
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.hero__chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--shape-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.02em;
  margin-bottom: 40px;
}

.hero__dot {
  width: 8px;
  height: 8px;
  background: var(--md-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(103, 80, 164, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(103, 80, 164, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(103, 80, 164, 0); }
}

.hero__title {
  font-family: 'Roboto Flex', sans-serif;
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--md-on-surface);
  margin-bottom: 32px;
  font-variation-settings: "wdth" 100, "opsz" 144, "GRAD" 0;
}

.hero__title em {
  font-style: normal;
  color: var(--md-primary);
  font-variation-settings: "wdth" 85, "opsz" 144, "GRAD" 50;
  font-weight: 600;
}

.hero__body {
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.5;
  color: var(--md-on-surface-variant);
  max-width: 640px;
  margin-bottom: 40px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   Features
   ========================================================================== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  padding: 32px;
  border-radius: var(--shape-xl);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
  cursor: default;
}

.feature-card:active {
  transform: scale(0.99);
  transition: transform 0.1s ease;
}

@media (hover: hover) {
  .feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.05);
  }
}

.feature-card--secondary {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}

.feature-card--tertiary {
  background: var(--md-tertiary-container);
  color: var(--md-on-tertiary-container);
}

.feature-card--primary {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.feature-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--shape-md);
  display: grid;
  place-items: center;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.45);
  margin-bottom: 12px;
  transition: transform 0.3s var(--ease-spring);
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 28;
}

@media (hover: hover) {
  .feature-card:hover .feature-card__icon {
    transform: rotate(-8deg);
  }
}

.feature-card__title {
  font-family: 'Roboto Flex', sans-serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  font-variation-settings: "wdth" 100, "opsz" 32;
}

.feature-card__body {
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.85;
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact {
  margin-top: 8px;
}

.contact__card {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border-radius: var(--shape-xxl);
  padding: clamp(40px, 7vw, 80px);
  position: relative;
  overflow: hidden;
}

.contact__card::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  pointer-events: none;
}

.contact__card > * { position: relative; z-index: 1; }

.contact__overline {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--md-primary);
  margin-bottom: 24px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--shape-full);
}

.contact__heading {
  font-family: 'Roboto Flex', sans-serif;
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--md-on-primary-container);
  margin-bottom: 24px;
  font-variation-settings: "wdth" 100, "opsz" 144;
}

.contact__body {
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.55;
  color: var(--md-on-primary-container);
  opacity: 0.85;
  max-width: 560px;
  margin-bottom: 40px;
}

.contact__address-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(33, 0, 93, 0.15);
}

.contact__address-block .material-symbols-rounded {
  color: var(--md-primary);
  margin-top: 2px;
  font-size: 22px;
}

.contact__address-block address {
  font-style: normal;
  font-size: 14px;
  line-height: 1.6;
  color: var(--md-on-primary-container);
}

.contact__address-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

@media (hover: hover) {
  .contact__address-link:hover {
    border-bottom-color: currentColor;
  }
}

.contact__address-link:active {
  opacity: 0.7;
}

.features-dots {
  display: none;
  justify-content: center;
  gap: 8px;
  margin-top: -4px;
  padding: 12px 0 4px;
}

.features-dots__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--md-outline-variant);
  transition: width 0.3s var(--ease-spring), background 0.3s ease;
}

.features-dots__dot--active {
  width: 24px;
  background: var(--md-primary);
}

.contact__address-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 40px 48px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.01em;
}

.footer__dot {
  opacity: 0.4;
}

/* ==========================================================================
   Entrance Animations
   ========================================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero__chip,
.hero__title,
.hero__body,
.hero__actions {
  animation: fadeUp 0.9s var(--ease-emphasized-decel) backwards;
}

.hero__chip    { animation-delay: 0.1s; }
.hero__title   { animation-delay: 0.2s; }
.hero__body    { animation-delay: 0.35s; }
.hero__actions { animation-delay: 0.5s; }

@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;
  }
}

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

/* Tablet (≤960px): keep 3 columns but more compact cards */
@media (max-width: 960px) {
  .feature-card {
    padding: 24px;
  }

  .feature-card__icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 14px;
  }

  .feature-card__title {
    font-size: 22px;
    margin-bottom: 4px;
  }

  .feature-card__body {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* Mobile (≤720px): rebuild for phones */
@media (max-width: 720px) {
  html {
    scroll-padding-top: 76px;
  }

  main {
    padding: 12px;
    gap: 12px;
  }

  .app-bar {
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    background: rgba(254, 247, 255, 0.92);
  }

  .app-bar__logo {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .app-bar__name {
    font-size: 17px;
  }

  .app-bar .btn--tonal {
    padding: 9px 14px;
    font-size: 13px;
  }

  .app-bar .btn--tonal .material-symbols-rounded {
    font-size: 16px;
  }

  .hero {
    padding: 44px 24px 56px;
    border-radius: var(--shape-xl);
  }

  .hero::before {
    width: 320px;
    height: 320px;
    top: -100px;
    right: -100px;
  }

  .hero::after {
    width: 380px;
    height: 380px;
    bottom: -160px;
    left: -120px;
  }

  .hero__chip {
    margin-bottom: 36px;
    padding: 7px 14px 7px 10px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .hero__title {
    font-size: 48px;
    line-height: 1.02;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
  }

  .hero__body {
    font-size: 16px;
    line-height: 1.55;
    margin-bottom: 32px;
  }

  .hero__actions {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }

  .hero__actions .btn--filled {
    width: 100%;
    justify-content: center;
    padding: 16px 24px;
    font-size: 15px;
    border-radius: var(--shape-md);
  }

  .hero__actions .btn--text {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
  }

  .features {
    display: flex;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    gap: 12px;
    scroll-padding-left: 12px;
    margin-left: -12px;
    margin-right: -12px;
    padding: 4px 12px 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .features::-webkit-scrollbar {
    display: none;
  }

  .feature-card {
    flex: 0 0 80%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border-radius: var(--shape-lg);
  }

  .features-dots {
    display: flex;
  }

  .contact__card {
    padding: 44px 24px 32px;
    border-radius: var(--shape-xl);
  }

  .contact__overline {
    font-size: 11px;
    padding: 5px 12px;
    margin-bottom: 20px;
  }

  .contact__heading {
    font-size: 44px;
    line-height: 1.02;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
  }

  .contact__body {
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 28px;
  }

  .btn--fab-extended {
    width: 100%;
    padding: 18px 24px;
    font-size: 15px;
    justify-content: center;
    gap: 10px;
    border-radius: var(--shape-md);
  }

  .contact__address-block {
    margin-top: 32px;
    padding-top: 24px;
  }

  .contact__address-block address {
    font-size: 13px;
  }

  .footer {
    padding: 24px 16px 36px;
    padding-bottom: calc(36px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    flex-direction: column;
    gap: 6px;
    text-align: center;
    font-size: 12px;
  }

  .footer__dot {
    display: none;
  }
}

/* Small phones (≤380px): Galaxy S, iPhone mini */
@media (max-width: 380px) {
  .hero {
    padding: 40px 20px 48px;
  }

  .hero__title {
    font-size: 42px;
  }

  .hero__chip {
    font-size: 10px;
    letter-spacing: 0.02em;
    padding: 6px 12px 6px 9px;
  }

  .hero__body {
    font-size: 15px;
  }

  .contact__card {
    padding: 40px 20px 28px;
  }

  .contact__heading {
    font-size: 38px;
  }

  .feature-card {
    padding: 20px;
  }

  .app-bar {
    padding: 12px 14px;
  }

  .app-bar__name {
    font-size: 16px;
  }
}
