/* Yu Yuen Hern portfolio: plain CSS, no framework. */

:root {
  --bg: #000;
  --bg-alt: #1a1a1a;
  --accent: #d43f52;
  --text: #b3b3b3;
  --heading: #fff;
  --radius: 4px;
  --space-section: clamp(64px, 10vw, 120px);
  --font: "Raleway", system-ui, sans-serif;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  color: var(--heading);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
  font-size: 1.1rem;
}

a {
  color: inherit;
}

.container {
  max-width: 1170px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Focus and skip link */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--heading);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.icon {
  width: 24px;
  height: 24px;
  fill: var(--accent);
}

/* Sections */
.section {
  padding-block: var(--space-section);
}

.section--alt {
  background: var(--bg-alt);
}

.section h2 {
  margin-bottom: 40px;
}

#work h2,
#portfolio h2 {
  text-align: center;
}

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-block: 120px;
  background: var(--bg) url("../images/ai-landscape.webp") center / cover no-repeat;
  text-align: center;
}

.hero .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  color: var(--heading);
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
}

.hero h1 {
  display: inline-block;
  border: 2px solid var(--accent);
  letter-spacing: 6px;
  padding: 25px 35px;
  margin-block: 16px;
  text-transform: uppercase;
}

.rotate {
  color: var(--accent);
  font-size: clamp(1.25rem, 3.5vw, 1.875rem);
  font-weight: 700;
  text-transform: uppercase;
  min-height: 3.2em;
}

.rotate__text {
  transition: opacity 0.4s ease;
}

.rotate__text.is-fading {
  opacity: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 60px;
  margin-top: 24px;
  border: 2px solid var(--heading);
  background: transparent;
  color: var(--heading);
  font-weight: 700;
  text-decoration: none;
  transition:
    background-color 0.4s ease,
    border-color 0.4s ease;
}

.btn:hover {
  background: var(--accent);
  border-color: transparent;
}

/* Section dots */
.dots {
  display: none;
  position: fixed;
  right: 20px;
  top: 50%;
  z-index: 10;
  transform: translateY(-50%);
}

.dots ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  padding: 0;
}

.dots a {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--heading);
  border-radius: 50%;
  background: transparent;
  transition: background-color 0.3s ease;
}

.dots a.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

@media (width >= 768px) {
  .dots {
    display: block;
  }
}

/* Work */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  list-style: none;
  padding: 0;
}

@media (width >= 768px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 1200px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skill {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.skill__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border: 2px solid var(--heading);
  border-radius: 50%;
  transition: background-color 0.4s ease-in;
}

.skill:hover .skill__icon {
  background: var(--heading);
}

.skill h3 {
  margin-bottom: 8px;
}

/* About */
.about-grid {
  display: grid;
  gap: 48px;
  align-items: start;
}

@media (width >= 768px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subtitle {
  color: var(--accent);
  font-weight: 700;
  padding-block: 15px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 20px;
  list-style: none;
  padding: 0;
}

.bars li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}

.bar__label {
  color: var(--heading);
  font-weight: 700;
}

.bar__value {
  color: var(--heading);
  font-weight: 700;
  margin-left: auto;
}

.bar {
  appearance: none;
  flex-basis: 100%;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: transparent;
}

.bar::-webkit-progress-bar {
  background: var(--heading);
  border-radius: var(--radius);
}

.bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: var(--radius);
}

.bar::-moz-progress-bar {
  background: var(--accent);
  border-radius: var(--radius);
}

/* Portfolio */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  list-style: none;
  padding: 0;
}

@media (width >= 600px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 992px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card article {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.card__body {
  padding: 16px;
}

.card h3 {
  margin-bottom: 8px;
}

.card__body p {
  font-size: 0.875rem;
}

.card__body p + p {
  margin-top: 8px;
}

.card__body a {
  color: var(--heading);
  text-decoration: underline;
}

/* Desktop: text overlays the image on hover or keyboard focus */
@media (width >= 768px) {
  .card__body {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--accent);
    color: var(--heading);
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    transition:
      opacity 0.4s ease-in-out,
      transform 0.4s ease-in-out;
  }

  .card:hover .card__body,
  .card:focus-within .card__body {
    opacity: 0.9;
    transform: none;
  }

  .card__body p,
  .card__body a {
    color: var(--heading);
  }
}

/* Contact */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
  padding: 0;
}

.social a {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 2px solid var(--heading);
  border-radius: 50%;
  transition: background-color 0.4s ease-in;
}

.social a:hover,
.social a:focus-visible {
  background: var(--heading);
}

.social .icon {
  width: 22px;
  height: 22px;
}

/* Footer */
.footer {
  padding-block: 40px 20px;
  border-top: 1px solid #090909;
  text-align: center;
  font-size: 0.875rem;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  .reveal {
    opacity: 1;
    transform: none;
  }
}
