/* ============================================
   Nanook ❄️ — Personal Website
   Two-column layout, arctic blue aesthetic
   ============================================ */

:root {
  --ice-50: #f0f9ff;
  --ice-100: #e0f2fe;
  --ice-200: #bae6fd;
  --ice-300: #7dd3fc;
  --ice-400: #38bdf8;
  --ice-500: #0ea5e9;
  --ice-600: #0284c7;
  --ice-700: #0369a1;
  --ice-800: #075985;
  --ice-900: #0c4a6e;
  --dark-900: #0a0f1a;
  --dark-800: #0f172a;
  --dark-700: #1e293b;
  --dark-600: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --glow: rgba(56, 189, 248, 0.3);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--dark-900);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Aurora background */
.aurora {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(14, 165, 233, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 30%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 70% 40% at 50% 80%, rgba(3, 105, 161, 0.1) 0%, transparent 50%),
    linear-gradient(180deg, var(--dark-900) 0%, #0a1628 50%, var(--dark-900) 100%);
}

/* Falling snowflakes */
.snowflakes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.snowflake {
  position: absolute;
  top: -5%;
  color: rgba(186, 230, 253, 0.12);
  font-size: 1rem;
  animation: snowfall linear infinite;
}

.snowflake:nth-child(1) { left: 5%;  animation-duration: 18s; animation-delay: 0s;  font-size: 0.8rem; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 22s; animation-delay: 3s;  font-size: 1.2rem; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 16s; animation-delay: 1s;  font-size: 0.6rem; }
.snowflake:nth-child(4) { left: 45%; animation-duration: 20s; animation-delay: 5s;  font-size: 1rem; }
.snowflake:nth-child(5) { left: 60%; animation-duration: 24s; animation-delay: 2s;  font-size: 0.9rem; }
.snowflake:nth-child(6) { left: 75%; animation-duration: 17s; animation-delay: 4s;  font-size: 1.1rem; }
.snowflake:nth-child(7) { left: 85%; animation-duration: 21s; animation-delay: 6s;  font-size: 0.7rem; }
.snowflake:nth-child(8) { left: 95%; animation-duration: 19s; animation-delay: 1.5s; font-size: 0.85rem; }

@keyframes snowfall {
  0%   { transform: translateY(-5vh) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(105vh) translateX(50px) rotate(360deg); opacity: 0; }
}

/* ============================================
   Two-column card layout
   ============================================ */
main {
  width: 92%;
  max-width: 1300px;
  margin: 2rem auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0;
  min-height: calc(100vh - 4rem);
  min-height: calc(100dvh - 4rem);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(30, 41, 59, 0.8);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---- Sidebar (left column) ---- */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  text-align: center;
  background: rgba(10, 15, 30, 0.7);
  border-right: 2px solid rgba(56, 189, 248, 0.2);
  padding: 2.5rem 1.75rem;
}

.avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: 1.25rem;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--ice-400);
  background: var(--dark-800);
  position: relative;
  z-index: 1;
}

.avatar-glow {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  z-index: 0;
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.snowflake-icon {
  display: inline-block;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1) rotate(15deg); }
}

.tagline {
  font-size: 1.05rem;
  color: var(--ice-400);
  font-weight: 500;
  margin-top: 0.2rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Interests (in sidebar) */
.interests {
  margin-top: 1.5rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 16px;
  font-size: 0.72rem;
  color: var(--ice-300);
  transition: background 0.2s;
}

.tag:hover {
  background: rgba(14, 165, 233, 0.2);
}

/* Connect links (sidebar) */
.connect {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--dark-700);
  border-radius: 8px;
  text-decoration: none !important;
  transition: border-color 0.2s, background 0.2s;
}

.link-item:hover {
  border-color: var(--ice-600);
  background: rgba(15, 23, 42, 0.8);
}

.link-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.link-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.link-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.link-handle {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ---- Content (right column) ---- */
.content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 2.5rem 2.5rem 1.5rem;
}

section {
  margin-bottom: 2rem;
}

section:first-child {
  margin-top: 0;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ice-300);
  margin-bottom: 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--dark-700);
}

p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

a {
  color: var(--ice-400);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--ice-300);
}

/* Trait cards — 2×2 grid */
.trait-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.trait-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid var(--dark-700);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  transition: border-color 0.2s;
}

.trait-card:hover {
  border-color: var(--ice-600);
}

.trait-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.trait-body h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.trait-body p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

/* Projects — compact grid */
.projects-intro {
  margin-bottom: 0.75rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.project {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.75rem;
  background: rgba(10, 15, 30, 0.35);
  border: 1px solid rgba(30, 41, 59, 0.6);
  border-radius: 6px;
  transition: border-color 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.project:hover {
  border-color: var(--ice-700);
}

.project-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.test-count {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--ice-500, #38bdf8);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 9px;
  padding: 0.05rem 0.4rem;
  letter-spacing: 0.02em;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

/* Footer — spans full width */
footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.25rem 1.5rem 1rem;
  border-top: 1px solid var(--dark-700);
  background: rgba(10, 15, 30, 0.3);
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.footer-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.15rem;
}

/* ============================================
   Responsive: tablet (narrow two-column)
   ============================================ */
@media (max-width: 1024px) {
  main {
    grid-template-columns: 250px 1fr;
    width: 96%;
    margin: 1.5rem auto;
  }

  .sidebar {
    padding: 2rem 1.25rem;
  }

  .content {
    padding: 2rem 1.75rem 1.25rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Responsive: stack on mobile
   ============================================ */
@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    width: 95%;
    margin: 1rem auto;
    min-height: auto;
    border-radius: 12px;
  }

  .sidebar {
    grid-column: 1;
    grid-row: auto;
    position: static;
    max-height: none;
    padding: 1.5rem 1.25rem 1.25rem;
    border-right: none;
    border-bottom: 2px solid rgba(56, 189, 248, 0.2);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    gap: 0 1.25rem;
    text-align: left;
    align-items: start;
  }

  .avatar-container {
    grid-row: 1 / 3;
    grid-column: 1;
    margin-bottom: 0;
    align-self: center;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }

  .avatar-glow {
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
  }

  /* Name + tagline sit next to avatar */
  .sidebar h1 {
    grid-row: 1;
    grid-column: 2;
    font-size: 1.6rem;
    align-self: end;
  }

  .tagline {
    grid-row: 2;
    grid-column: 2;
    align-self: start;
    font-size: 0.95rem;
  }

  .subtitle {
    grid-row: 3;
    grid-column: 1 / -1;
    margin-top: 0.75rem;
    text-align: center;
  }

  .interests {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
  }

  .tags {
    justify-content: flex-start;
  }

  .connect {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .link-item {
    flex: 0 1 auto;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    align-items: center;
  }

  .link-text {
    flex-direction: row;
    gap: 0.35rem;
    align-items: baseline;
  }

  .link-handle {
    display: none;
  }

  .content {
    grid-column: 1;
    grid-row: auto;
    padding: 1.5rem 1.25rem 1rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  .trait-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .trait-card {
    padding: 0.6rem 0.7rem;
  }

  .trait-body h3 {
    font-size: 0.8rem;
  }

  .trait-body p {
    font-size: 0.72rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  footer {
    padding: 1rem 1.25rem 0.75rem;
  }
}

/* ============================================
   Responsive: small phones (≤480px)
   ============================================ */
@media (max-width: 480px) {
  main {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .sidebar {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.25rem 1rem 1rem;
  }

  .avatar-container {
    grid-row: auto;
    grid-column: auto;
    justify-self: center;
    margin-bottom: 0.75rem;
  }

  .avatar {
    width: 72px;
    height: 72px;
  }

  .sidebar h1 {
    grid-row: auto;
    grid-column: auto;
    font-size: 1.5rem;
    text-align: center;
  }

  .tagline {
    grid-row: auto;
    grid-column: auto;
    text-align: center;
    font-size: 0.9rem;
  }

  .subtitle {
    grid-column: auto;
    margin-top: 0.35rem;
    font-size: 0.8rem;
  }

  .interests {
    grid-column: auto;
  }

  .tags {
    justify-content: center;
    gap: 0.35rem;
  }

  .tag {
    font-size: 0.68rem;
    padding: 0.18rem 0.5rem;
  }

  .connect {
    grid-column: auto;
    flex-direction: column;
    gap: 0.4rem;
  }

  .link-item {
    min-height: 44px;
    padding: 0.5rem 0.7rem;
  }

  .link-handle {
    display: block;
  }

  .link-text {
    flex-direction: column;
    gap: 0;
  }

  .content {
    padding: 1.25rem 1rem 0.75rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  p {
    font-size: 0.88rem;
  }

  .trait-grid {
    grid-template-columns: 1fr;
  }

  .trait-icon {
    font-size: 1.1rem;
  }

  .project-name {
    font-size: 0.82rem;
  }

  .project-desc {
    font-size: 0.72rem;
  }

  .footer-text {
    font-size: 0.75rem;
  }

  .footer-sub {
    font-size: 0.68rem;
  }
}

/* ============================================
   Responsive: very narrow screens (≤360px)
   ============================================ */
@media (max-width: 360px) {
  .sidebar {
    padding: 1rem 0.75rem 0.75rem;
  }

  .sidebar h1 {
    font-size: 1.35rem;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }

  .content {
    padding: 1rem 0.75rem 0.5rem;
  }

  .trait-card {
    padding: 0.5rem 0.6rem;
  }
}

/* ============================================
   Safe areas for notched devices
   ============================================ */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 480px) {
    main {
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }

    footer {
      padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .snowflake { animation: none; display: none; }
  .avatar-glow { animation: none; }
  .snowflake-icon { animation: none; }
  html { scroll-behavior: auto; }
}
