/* 1. Tokens */
:root {
  --container: 1140px;
  --content: 1100px;
  --gap: 22px;
  --page-bg: #f1f1ef;
  --card-bg: #f7f7f5;
  --card-soft: #eeeeec;
  --card-border: 1px solid rgb(0 0 0 / 0.14);
  --card-radius: 12px;
  --header-height: 34px;
  --text: rgb(0 0 0 / 0.78);
  --muted: rgb(0 0 0 / 0.45);
  --soft-line: rgb(0 0 0 / 0.1);
  --cell: 165px;
}

:root[data-theme="dark"] {
  --page-bg: #151514;
  --card-bg: #20201e;
  --card-soft: #2b2b28;
  --card-border: 1px solid rgb(255 255 255 / 0.16);
  --text: #f4f4ef;
  --muted: rgb(255 255 255 / 0.52);
  --soft-line: rgb(255 255 255 / 0.1);
}

/* 2. Base */
* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
p,
blockquote {
  margin: 0;
}

.page-shell {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 164px 20px 64px;
}

/* 3. Header */
.profile-header {
  display: flex;
  width: 100%;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--card-border);
  padding-bottom: 19px;
}

.profile-header__person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 15px;
}

.avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(0,0,0,0.08);
  display: block;
  flex: 0 0 auto;
}

.profile-header h1 {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-header p {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 4. Bento grid */
.resume-grid {
  display: grid;
  grid-template-areas:
    "time mode about about experience experience"
    "projects projects contact contact experience experience"
    "projects projects product product side side"
    "newsletter testimonial product product countdown cv";
  grid-template-columns: repeat(6, var(--cell));
  grid-auto-flow: row;
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  margin-top: 29px;
}

.area-time { grid-area: time; }
.area-mode { grid-area: mode; }
.area-about { grid-area: about; }
.area-experience { grid-area: experience; }
.area-projects { grid-area: projects; }
.area-contact { grid-area: contact; }
.area-product { grid-area: product; }
.area-side { grid-area: side; }
.area-newsletter { grid-area: newsletter; }
.area-testimonial { grid-area: testimonial; }
.area-countdown { grid-area: countdown; }
.area-cv { grid-area: cv; }

.area-time,
.area-mode,
.area-about,
.area-contact,
.area-side,
.area-newsletter,
.area-testimonial,
.area-countdown,
.area-cv {
  height: var(--cell);
}

.area-projects,
.area-experience,
.area-product {
  height: calc((var(--cell) * 2) + var(--gap));
}

/* 5. Cards */
.card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: var(--card-border);
  border-radius: var(--card-radius);
  background: var(--card-bg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.card:hover {
  transform: translateY(-1px);
}

.card__header {
  display: flex;
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding: 0 10px;
}

.card__header h2,
.card__header span,
.card__header a {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__header h2 {
  flex: 0 1 auto;
  color: var(--text);
  font-weight: 600;
}

.card__body {
  min-height: 0;
  flex: 1;
  padding: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

/* 6. Scroll fade cards */
.scroll-fade {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.scroll-fade::before,
.scroll-fade::after {
  position: absolute;
  right: 8px;
  left: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
  content: "";
}

.scroll-fade::before {
  top: 0;
  height: 36px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--card-bg) 88%, transparent), transparent 74%);
  backdrop-filter: blur(2px);
}

.scroll-fade::after {
  bottom: 0;
  height: 36px;
  background: linear-gradient(to top, color-mix(in srgb, var(--card-bg) 88%, transparent), transparent 74%);
  backdrop-filter: blur(2px);
}

.scroll-fade.has-top::before,
.scroll-fade.has-bottom::after {
  opacity: 1;
}

.scroll-area {
  height: 100%;
  overflow-y: auto;
  padding: 0 10px;
  scrollbar-color: #b8b8b4 transparent;
  scrollbar-width: thin;
}

.scroll-area::-webkit-scrollbar {
  width: 8px;
}

.scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-area::-webkit-scrollbar-thumb {
  border: 2px solid var(--card-bg);
  border-radius: 999px;
  background: #b8b8b4;
}

.timeline section {
  display: grid;
  min-height: 68px;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 20px;
  border-bottom: 1px solid var(--soft-line);
  padding: 10px 0;
}

.timeline section:first-child {
  min-height: 108px;
}

.timeline time,
.side-list span,
.project-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
}

.timeline h3,
.side-list strong,
.project-row strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 14px;
}

.timeline p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
}

.side-list a {
  display: grid;
  min-height: 60px;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding: 10px 0;
}

/* 7. Components */
.theme-switch {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 20;
  display: inline-grid;
  width: 100px;
  height: 27px;
  place-items: center;
  transform: translateX(-50%);
  border: var(--card-border);
  border-top: 0;
  border-radius: 0 0 999px 999px;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  color: var(--text);
  cursor: pointer;
}

.theme-switch__label {
  position: absolute;
  opacity: 0;
}

.theme-switch__value {
  font-size: 11px;
  font-weight: 500;
}

.pill-button {
  display: inline-flex;
  width: 145px;
  height: 27px;
  align-items: center;
  justify-content: space-between;
  border: var(--card-border);
  border-radius: 999px;
  background: var(--card-bg);
  padding: 0 14px;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.pill-button span:last-child {
  transition: transform 160ms ease;
}

.pill-button:hover span:last-child {
  transform: translate(2px, -2px);
}

.clock-body {
  display: grid;
  place-items: center;
}

.clock {
  width: 100px;
  height: 100px;
  fill: none;
}

.clock__ring {
  stroke: color-mix(in srgb, var(--text) 12%, transparent);
  stroke-width: 1;
}

.clock__ticks line {
  stroke: color-mix(in srgb, var(--text) 28%, transparent);
  stroke-linecap: round;
  stroke-width: 0.8;
}

.clock__ticks .is-major {
  stroke: color-mix(in srgb, var(--text) 42%, transparent);
  stroke-width: 1;
}

.clock__hand {
  stroke: color-mix(in srgb, var(--text) 78%, transparent);
  stroke-linecap: round;
}

.clock__hour {
  stroke-width: 1.9;
}

.clock__minute {
  stroke-width: 1.35;
}

.clock__pin {
  fill: color-mix(in srgb, var(--text) 80%, transparent);
}

.mode-body,
.cv-buttons,
.newsletter-form {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.mode-body {
  justify-content: space-between;
  padding-top: 34px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: #f2cc58;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06);
}

.projects-list {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}

.project-row {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  background: var(--card-soft);
  padding: 7px 8px;
}

.project-row > span:last-child {
  min-width: 0;
}

.project-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #222;
  box-shadow: inset 0 1px 3px rgb(255 255 255 / 0.14);
}

.project-thumb--one {
  background:
    radial-gradient(circle at 64% 30%, #e8e8e4 0 8%, transparent 9%),
    linear-gradient(145deg, #171717, #666);
}

.project-thumb--two {
  background:
    linear-gradient(135deg, transparent 0 45%, #f1f1ef 46% 54%, transparent 55%),
    linear-gradient(145deg, #7a7a76, #191918);
}

.project-thumb--three {
  background:
    radial-gradient(circle at 36% 38%, #d8d8d3 0 12%, transparent 13%),
    linear-gradient(160deg, #555, #111 65%);
}

.icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.icon-button {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border: var(--card-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  transition: transform 160ms ease;
}

.icon-button:hover {
  transform: scale(1.03);
}

.product-card {
  background: #aaa9a4;
  color: #fff;
}

.product-card .card__header {
  border-bottom-color: rgb(255 255 255 / 0.16);
}

.product-card .card__header h2,
.product-card .card__header a {
  color: #fff;
}

.product-visual {
  position: absolute;
  inset: var(--header-height) 0 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, #c3c3bf 0%, #b1b1ad 62%, #a8a8a3 100%);
}

.product-visual::after {
  position: absolute;
  inset-inline: 0;
  bottom: -10px;
  height: 126px;
  background:
    repeating-linear-gradient(115deg, rgb(255 255 255 / 0.08) 0 1px, transparent 1px 8px),
    linear-gradient(168deg, transparent 0 22%, #4f4f4d 23% 100%);
  content: "";
}

.product-stand {
  position: absolute;
  bottom: 72px;
  left: 50%;
  z-index: 1;
  width: 98px;
  height: 150px;
  transform: translateX(-50%) perspective(420px) rotateX(2deg);
  border: 1px solid rgb(255 255 255 / 0.34);
  border-radius: 18px 18px 5px 5px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 0.2), transparent 22% 75%, rgb(0 0 0 / 0.08)),
    linear-gradient(90deg, #d6d6d1, #b7b7b2 42%, #eeeeea 67%, #adada8);
  box-shadow: 0 22px 40px rgb(0 0 0 / 0.2);
}

.product-arm {
  position: absolute;
  bottom: 206px;
  left: calc(50% - 10px);
  z-index: 2;
  width: 22px;
  height: 108px;
  transform: rotate(87deg);
  border-radius: 999px 999px 6px 6px;
  background: #1f1f1e;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
}

.newsletter-form input,
.newsletter-form button {
  width: 100%;
  height: 30px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.newsletter-form input {
  min-width: 0;
  border: var(--card-border);
  background: var(--card-bg);
  padding: 0 14px;
  color: var(--text);
}

.newsletter-form input::placeholder {
  color: color-mix(in srgb, var(--muted) 65%, transparent);
}

.newsletter-form button {
  border: 0;
  background: var(--card-soft);
  color: var(--text);
  cursor: pointer;
}

.quote-card {
  justify-content: space-between;
  padding: 35px 10px 10px;
}

.quote-card blockquote {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
}

.quote-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quote-author > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 999px;
  background: linear-gradient(145deg, #1a1a19, #8d8d88);
}

.quote-author p:first-child {
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  line-height: 13px;
}

.quote-author p:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 13px;
}

.countdown {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--text);
  font-size: 84px;
  font-weight: 500;
  line-height: 0.82;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
  border-top: var(--card-border);
  padding-top: 15px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 12px;
}

.footer strong {
  color: var(--text);
  font-weight: 500;
}

/* 8. Responsive breakpoints */
@media (min-width: 1440px) {
  .page-shell {
    width: var(--container);
  }

  .resume-grid {
    grid-template-columns: repeat(6, var(--cell));
  }
}

@media (max-width: 1199px) {
  :root {
    --container: calc(100vw - 48px);
    --gap: 16px;
  }

  .page-shell {
    width: var(--container);
    margin-right: calc((100vw - var(--container)) / 2);
    margin-left: calc((100vw - var(--container)) / 2);
    padding-right: 0;
    padding-left: 0;
  }

  .resume-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  :root {
    --container: calc(100vw - 40px);
    --gap: 22px;
  }

  .page-shell {
    padding-top: 20px;
  }

  .resume-grid {
    grid-template-areas:
      "time mode about about"
      "experience experience projects projects"
      "experience experience projects projects"
      "contact contact product product"
      "side side product product"
      "newsletter testimonial countdown cv";
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: var(--cell);
    margin-top: 29px;
  }

  .area-experience,
  .area-projects {
    height: 352px;
  }

  .area-side {
    height: 165px;
  }

  .area-product {
    height: 352px;
  }

  .mode-body {
    padding-top: 28px;
  }

  .timeline section {
    grid-template-columns: 147px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --container: calc(100vw - 20px);
    --gap: 10px;
  }

  .page-shell {
    padding-top: 30px;
    padding-bottom: 30px;
  }

  .profile-header {
    min-height: 60px;
  }

  .profile-header .pill-button {
    width: 145px;
  }

  .resume-grid {
    grid-template-areas:
      "time mode"
      "about about"
      "experience experience"
      "projects projects"
      "contact contact"
      "product product"
      "side side"
      "newsletter testimonial"
      "countdown cv";
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(var(--cell), auto);
    margin-top: 29px;
  }

  .area-experience {
    height: 340px;
    max-height: 340px;
  }

  .area-side {
    height: 260px;
    max-height: 260px;
  }

  .area-projects,
  .area-contact {
    min-height: 300px;
  }

  .area-product {
    height: 340px;
  }

  .timeline section {
    grid-template-columns: minmax(94px, 30%) minmax(0, 1fr);
    gap: 20px;
  }

  .timeline section:first-child {
    min-height: 104px;
  }

  .icon-row {
    flex-wrap: wrap;
    gap: 14px;
  }

  .footer {
    margin-top: 30px;
  }
}

@media (max-width: 430px) {
  :root {
    --container: calc(100vw - 20px);
  }

  .page-shell {
    padding-top: 30px;
  }

  .profile-header {
    gap: 12px;
  }

  .profile-header__person {
    gap: 15px;
  }

  .profile-header p {
    max-width: 150px;
  }

  .profile-header .pill-button {
    width: min(145px, 40vw);
    padding-inline: 12px;
  }

  .mode-body {
    padding-top: 28px;
  }

  .clock {
    width: 94px;
    height: 94px;
  }

  .card__body {
    line-height: 15px;
  }

  .area-product {
    height: 280px;
  }

  .area-projects {
    min-height: 304px;
  }

  .area-contact {
    min-height: 165px;
  }

  .icon-row {
    gap: 10px;
  }

  .icon-button {
    width: 56px;
    height: 56px;
  }

  .project-row {
    min-height: 70px;
  }

  .project-thumb {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .timeline section {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 20px;
  }

  .newsletter-form {
    gap: 10px;
  }

  .quote-card {
    padding-top: 35px;
  }

  .countdown {
    font-size: 72px;
  }

  .footer {
    align-items: flex-start;
  }
}

@media (max-width: 375px) {
  :root {
    --container: calc(100vw - 20px);
  }

  .profile-header p {
    max-width: 132px;
  }

  .profile-header .pill-button {
    width: 128px;
  }

  .card__header {
    gap: 8px;
  }

  .card__header h2,
  .card__header span,
  .card__header a {
    font-size: 11px;
  }

  .mode-body {
    padding-top: 22px;
  }

  .icon-button {
    width: 52px;
    height: 52px;
  }

  .project-row {
    gap: 10px;
  }

  .timeline section {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
  }
}

@media (max-width: 767px) {
  .avatar-img {
    width: 36px;
    height: 36px;
  }
}
