/* ========================
   Global Reset & Base
   ======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(140deg, var(--color-bg) 0%, var(--color-bg-accent) 100%) fixed;
  color: var(--color-text);
  line-height: 1.5;
  letter-spacing: 0.2px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(5rem, 8vh, 6rem) 1rem clamp(1.25rem, 3vh, 3rem);
  min-height: 100vh;
}

.site {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ========================
   Profile Layout
   ======================== */
.profile {
  display: grid;
  grid-template-columns: auto auto;
  align-items: stretch;
  gap: clamp(1rem, 2.5vw, 1.5rem);
}

@media (max-height: 680px) {
  .profile {
    margin-top: 1rem;
  }
}

/* ========================
   Card
   ======================== */
.card {
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.75rem, 5vw, 3.75rem);
  width: min(600px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

.card__header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.25rem);
  line-height: 0.92;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.045em;
  text-rendering: optimizeLegibility;
}

.tagline {
  margin: 0;
  font-size: clamp(1rem, 2.1vw, 1.25rem);
  font-weight: 500;
  max-width: 34ch;
}

.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-border-strong) 10%,
    var(--color-border) 50%,
    var(--color-border-strong) 90%,
    transparent
  );
}

/* ========================
   Polaroid
   ======================== */
.polaroid {
  display: flex;
  padding: 0.9rem;
  width: clamp(220px, 30vw, 300px);
}

.polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: var(--polaroid-img-filter);
  transition: filter 0.3s ease;
}

/* ========================
   Buttons
   ======================== */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.05rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  position: relative;
  min-width: 140px;
  transition: border-color 0.3s, background-color 0.3s, color 0.3s, transform 0.25s;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s;
  mix-blend-mode: screen;
  pointer-events: none;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--color-accent);
}

.btn:hover::before,
.btn:focus-visible::before {
  opacity: 0.18;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.btn__icon {
  display: flex;
}

/* ========================
   Theme Toggle
   ======================== */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  column-gap: 0.75rem;
}

.theme-toggle__switch {
  position: relative;
  display: flex;
  align-items: center;
  width: 3.5rem;
  height: 2rem;
  padding: 0.25rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.theme-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  transition: color 0.3s ease;
}

.theme-toggle__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.theme-toggle__icon--sun svg {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle__slider {
  position: absolute;
  top: 50%;
  left: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  transform: translate(0, -50%);
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Dark mode slider */
:root[data-theme="dark"] .theme-toggle__slider {
  transform: translate(1.5rem, -50%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__slider {
    transform: translate(1.5rem, -50%);
  }
}

.theme-dropdown {
  cursor: pointer;
}

/* ========================
   Focus Styles
   ======================== */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ========================
   Responsive Design
   ======================== */
@media (max-width: 560px) {
  .profile {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .polaroid {
    width: 100%;
  }

  .card {
    gap: 2rem;
  }

  .links {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
    column-gap: 0.6rem;
  }

  .theme-toggle__switch {
    width: 3rem;
    height: 1.75rem;
  }

  .theme-toggle__icon {
    width: 1.3rem;
    height: 1.3rem;
  }

  .theme-toggle__slider {
    width: 1.25rem;
    height: 1.25rem;
  }

  :root[data-theme="dark"] .theme-toggle__slider {
    transform: translate(1.25rem, -50%);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle__slider {
      transform: translate(1.25rem, -50%);
    }
  }
}

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