/* ==========================================================
   Bento profile page
   Built step by step in the PanhaInsight portfolio course.
   ========================================================== */

/* ---------- 1. Design tokens: every color and size lives here ---------- */
:root {
  --blue: #5b79a3;
  --blue-deep: #445f86;
  --blue-soft: #dbe4f0;
  --ink: #1f2a37;
  --ink-soft: #4a5868;
  --paper: #ffffff;
  --mist: #eef2f8;
  --online: #2ecc71;

  --radius-lg: 32px;
  --radius: 24px;
  --gap: 16px;
  --shadow: 0 10px 30px rgba(31, 42, 55, 0.12);

  --font: "Poppins", system-ui, sans-serif;
}

/* ---------- 2. Reset and page ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(90deg, var(--blue) 0%, #9fb2cc 45%, var(--mist) 100%);
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

/* The faded portrait behind the page */
.backdrop {
  position: fixed;
  right: -10%;
  top: -5%;
  width: min(900px, 80vw);
  opacity: 0.18;
  pointer-events: none;
  z-index: -1;
  /* Fade the bottom edge out instead of ending in a hard line */
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

/* ---------- 3. Top bar ---------- */
.topbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--paper);
}

.avatar {
  position: relative;
  flex-shrink: 0;
}

.avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  object-fit: cover;
}

.online-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--paper);
}

.profile-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.profile-name strong {
  font-size: 1.05rem;
}

.profile-name small {
  font-size: 0.75rem;
  opacity: 0.85;
}

.topbar nav {
  display: flex;
  gap: 8px;
}

.topbar nav a {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.topbar nav a[aria-current="page"] {
  background: var(--blue-deep);
  color: var(--paper);
}

.topbar nav a:hover:not([aria-current]) {
  background: rgba(255, 255, 255, 0.35);
}

/* ---------- 4. The bento grid ---------- */
.bento {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto 200px 160px 64px;
  grid-template-areas:
    "hero  hero  hero   hero"
    "about about cat    hoodie"
    "date  clock smool  more"
    "dock  dock  credit credit";
  gap: var(--gap);
}

.hero    { grid-area: hero; }
.about   { grid-area: about; }
.look-cat    { grid-area: cat; }
.look-hoodie { grid-area: hoodie; }
.look-smool  { grid-area: smool; }
.date    { grid-area: date; }
.clock   { grid-area: clock; }
.more    { grid-area: more; }
.dock    { grid-area: dock; }
.credits { grid-area: credit; }

/* Every tile shares this look */
.card {
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--paper);
}

/* ---------- 5. Hero ---------- */
.hero {
  min-height: 300px;
  margin-top: 40px; /* room for the portrait to stick out above */
  padding: 48px 56px 40px;
  border-radius: var(--radius-lg);
  background: var(--blue);
  color: var(--paper);
}

.hero-slides {
  display: grid;
  max-width: 52%;
}

/* All slides sit in the same grid cell; only the active one is visible */
.slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 400ms ease, transform 400ms ease, visibility 400ms;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.kana {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 8px;
}

.hero h1,
.slide-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
}

.slide p:last-child {
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.95;
}

.dots {
  position: relative;
  z-index: 1; /* stay clickable above the portrait */
  display: flex;
  gap: 8px;
  margin-top: 32px;
}

.dot {
  width: 48px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 200ms ease;
}

.dot.is-active {
  background: var(--paper);
}

/* Bigger tap area than the thin bar you can see */
.dot::before {
  content: "";
  display: block;
  height: 32px;
  margin-top: -13px;
}

.hero-portrait {
  position: absolute;
  right: 24px;
  bottom: 0;
  height: calc(100% + 40px); /* taller than the card, so it pokes out */
  width: auto;
  max-width: 48%;
  object-fit: contain;
  object-position: bottom;
  border-bottom-right-radius: var(--radius-lg);
}

/* ---------- 6. About ---------- */
.about {
  padding: 20px 24px;
  border: 2px solid var(--blue);
  display: flex;
  flex-direction: column;
}

.about-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue);
  margin-bottom: 12px;
}

.about-head h2 {
  font-size: 1.6rem;
  color: var(--blue-deep);
}

.about-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.about-body p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.about-body img {
  width: 88px;
  height: auto;
  flex-shrink: 0;
}

/* ---------- 7. Image cards ---------- */
.look {
  overflow: hidden;
  text-decoration: none;
  background: var(--blue-soft);
}

.look img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 400ms ease;
}

.look:hover img {
  transform: scale(1.05);
}

/* A soft blue fade so the white label is always readable */
.look::after {
  content: "";
  position: absolute;
  inset: 50% 0 0;
  background: linear-gradient(to top, var(--blue) 10%, transparent);
}

.look-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--paper);
}

.look-smool img {
  object-fit: contain;
  background: var(--paper);
}

/* ---------- 8. Birthday ---------- */
.date {
  padding: 18px 20px;
  background: var(--blue);
  color: var(--paper);
  overflow: hidden;
}

.date-day {
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 1;
}

.date-month {
  font-size: 1.1rem;
}

.date-kanji {
  margin-top: 6px;
  font-size: 1.6rem;
  font-weight: 700;
}

.date-countdown {
  position: absolute;
  right: 16px;
  bottom: 16px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.date-cake {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 2rem;
}

/* ---------- 9. Clock ---------- */
.clock {
  padding: 18px 20px;
  border: 2px solid var(--blue);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.clock-time {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--blue-deep);
  line-height: 1;
  font-variant-numeric: tabular-nums; /* digits don't jiggle as they change */
}

.clock-time small {
  font-size: 0.8rem;
  margin-left: 4px;
}

.clock-day {
  margin-top: 10px;
  font-size: 0.95rem;
}

.clock-date {
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---------- 10. View more ---------- */
.more {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--blue);
  color: var(--paper);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  transition: background 200ms ease;
}

.more:hover {
  background: var(--blue-deep);
}

.more-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--blue);
  font-size: 1.3rem;
  line-height: 1;
}

/* ---------- 11. Dock and credits ---------- */
.dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  border: 2px solid var(--blue);
  border-radius: 99px;
}

.dock a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--blue-deep);
  transition: background 200ms ease;
}

.dock a:hover {
  background: var(--blue-soft);
}

.dock svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 24px;
  border-radius: 99px;
  background: var(--blue);
  color: var(--paper);
  font-size: 0.9rem;
  font-weight: 500;
}

.credits-toggle {
  display: flex;
  gap: 5px;
  padding: 12px;
  border: 0;
  background: none;
  cursor: pointer;
}

.credits-toggle i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper);
}

.credits-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(340px, 90vw);
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  z-index: 10;
}

.credits-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.credits-panel ul {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.8;
}

.credits-panel a {
  color: var(--blue-deep);
}

.credits-note {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* ---------- 12. Keyboard focus: always visible ---------- */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- 13. Phones and small tablets ---------- */
@media (max-width: 720px) {
  .topbar {
    padding: 20px 16px 16px;
    flex-wrap: wrap;
  }

  .bento {
    padding: 0 16px 32px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto 220px 160px 150px 56px 56px;
    grid-template-areas:
      "hero   hero"
      "about  about"
      "cat    hoodie"
      "date   clock"
      "smool  more"
      "dock   dock"
      "credit credit";
  }

  .hero {
    padding: 28px 24px 240px;
    margin-top: 0;
  }

  .hero-slides {
    max-width: none;
  }

  .hero-portrait {
    height: 220px;
    max-width: none;
    right: 50%;
    transform: translateX(50%);
  }

  .credits-panel {
    right: 50%;
    transform: translateX(50%);
  }
}

/* ---------- 14. Respect "reduce motion" ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
