/* ==========================================================================
   Portfolio Site Styles (best practices)
   - Fonts, variables, base
   - Header + parallax (with feature queries)
   - Layout: about, tabs, lists, skills
   - Project cards, modal
   - Utilities, footer
   - Responsive + reduced motion
   ========================================================================== */

/* Google Fonts */
@import url("https://fonts.googleapis.com/css?family=Bree+Serif|Courgette|Figtree|Gaegu|Poiret+One|Urbanist");

/* ---------- CSS Variables ---------- */
:root {
  --clr-bg: #8d94ba;
  --clr-bg-soft: #ebecef;
  --clr-primary: #292b56;
  --clr-accent: #f06d06;
  --clr-white: #ffffff;
  --clr-muted: #888;

  --shadow-lg: 0 10px 20px -10px rgba(0, 0, 0, .6);

  --header-height-min: 6rem; /* compact header height */
  --sticky-offset: var(--header-height-min);

  --ff-serif: "Bree Serif", serif;
  --ff-display: "Courgette", cursive;
  --ff-sans: "Figtree", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  background-color: var(--clr-bg-soft);
  color: var(--clr-white);
  font-family: var(--ff-sans);
}

/* Headings */
h1, h2 {
  margin-block: 0;
}
h1 {
  font-family: var(--ff-serif);
  font-weight: 700;
  text-align: center;
}
h2 {
  font-weight: 700;
}

/* ---------- Header / Hero ---------- */
.header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  height: 100svh;
  background-color: var(--clr-accent);
  font-size: calc(4vw + 1em);
  border-bottom: 15px solid var(--clr-primary);
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  transform: translateX(0);
  color: var(--clr-white);
}

.title > h2 {
  display: block;
  opacity: 1;
  visibility: visible;
  max-height: 3rem;
  overflow: hidden;
  margin: 0;
  font-size: 3rem;
  font-family: var(--ff-sans);
}

/* Down-arrow chevron */
.chevron-box {
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-top: 15px solid var(--clr-white);
  transform: rotate(0deg) translateY(0) scale(3);
  margin-top: 50px;
}

/* ---------- Main Layout ---------- */
main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: var(--clr-bg-soft);
  padding-top: 100svh;
}

ul {
  list-style: none;
  padding: 0;
  max-width: 1400px;
  width: 80%;
  margin: 0 auto;
}

/* ---------- About ---------- */
.about-me {
  display: flex;
  justify-content: center;
  flex-flow: row wrap;
  gap: 0;
  padding: 50px;
  max-width: 1200px;
  margin: auto;
}

.about-text {
  width: 67%;
  padding: 0px 85px 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.about-me .about-text p {
  color: var(--clr-primary);
  font-family: var(--ff-sans);
  font-size: 1.5rem;
  margin: 0 0 15px;
}

.about-me .about-text p:last-of-type {
  margin: 0;
}

.about-img-container {
  width: 33%;
}

.about-img-container img {
  width: 100%;
  border-radius: 21px;
}

.resume-link, .css-links {
  color: var(--clr-accent);
  font-size: 20px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(240, 113, 13, 0.77);
}

details>summary {
  list-style: none;cursor: pointer;
}
summary::-webkit-details-marker {
  display: none
}
details {
    line-height: 1.75;
}

details a {
    text-decoration: none;
    cursor: pointer;
    color: var(--clr-primary)
}

/* Invisible anchor for jump links */
#topline {
  position: absolute;
  top: -110px;
  height: 1px;
}

/* ---------- Tabs (Portfolio Switch) ---------- */
.portfolio-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 14px;
  width: 100%;
  background: rgba(235, 236, 239, 0.75);
  position: relative;
}

.portfolio-switch.is-stuck {
  position: sticky;
  top: var(--sticky-offset);
  z-index: 1000;
}

.portfolio-switch button {
  padding: 1rem 2rem;
  cursor: pointer;
  color: var(--clr-white);
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  background: #7078a5;
  transition: transform .06s ease, background-color .2s ease;
}

.portfolio-switch button:hover {
  transform: translateY(-1px);
}

.portfolio-switch button:active {
  transform: translateY(0);
}

.portfolio-switch button.active {
  background: var(--clr-primary);
}

/* Accessible focus */
.portfolio-switch button:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--clr-accent), white 20%);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--clr-accent), transparent 70%);
}

/* ---------- Skills Panel ---------- */
#list-skills {
  width: 90%;
  max-width: 900px;
  margin: 75px auto;
  color: var(--clr-primary);
  font-family: var(--ff-sans);
}

#list-skills h1 {
  color: var(--clr-primary);
  margin-bottom: 1rem;
  font-size: 37px;
  text-align: left;
}

#list-skills h2 {
  font-family: var(--ff-serif);
  color: var(--clr-primary);
  margin-bottom: .5rem;
}

#list-skills section {
  margin: 1.25rem 0 1.5rem;
}

#list-skills h3 {
  margin: 0 0 .25rem;
  font-size: 1.25rem;
  color: var(--clr-primary);
}

#list-skills p {
  margin: 0 0 .75rem;
  font-size: 21px;
}

#list-skills ul {
  width: 100%;
  max-width: 100%;
}

/* ---------- Projects ---------- */
.project-timeline {
  position: relative;
}

.project-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 50px;
  margin: 75px auto;
  padding: 30px;
  color: black;
  width: auto;
  max-width: 1000px;
  box-shadow: var(--shadow-lg);
  border-radius: 0;
  background-color: var(--clr-white);
  box-sizing: content-box;
}

.shadow-wrapper {
  filter:
    drop-shadow(1px 5px 0px rgba(50, 50, 0, .15))
    drop-shadow(-1px 1px 0px rgba(50, 50, 0, .10));
}

.project-container .image-wrapper {
  width: min(300px, 90vw);
  height: calc(min(300px, 90vw) * 4 / 3);
  position: relative;
  overflow: hidden;
  /* fancy cut with clip-path:path() (progressive enhancement) */
  clip-path: path("M0,0 H300 V340 C240,380 180,300 150,340 C120,380 60,300 0,340 Z");
}

/* image */
.project-container .image-wrapper img {
  display: block;
  width: 100%;
  object-fit: cover;
  object-position: top center;
  cursor: zoom-in;
}

/* magnifier badge (text presentation) */
.project-container .image-wrapper::after {
  content: "\1F50D\FE0E";
  position: absolute;
  right: .5rem;
  bottom: 3.5rem;
  font-size: 28px;
  line-height: 1;
  background: var(--clr-white);
  border-radius: 999px;
  padding: .85rem;
  pointer-events: none;
}

/* Project details */
.project-container li {
  font-family: var(--ff-sans);
  font-size: 1.5rem;
  color: var(--clr-primary);
}

.project-container li span {
  color: var(--clr-primary);
  font-weight: 700;
}

.project-container li span.role {
  white-space: nowrap;
}

.project-container li a {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project-container li h2 {
  font-family: var(--ff-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--clr-primary);
  display: inline;
  position: relative;
  padding-right: 30px;
  white-space: nowrap;
}

.project-container li h2::after {
  content: "";
  position: absolute;
  inset-block-end: -1px;
  inset-inline-start: -3px;
  height: 100%;
  width: 0;
  z-index: -1;
  background: rgba(240, 109, 6, .47);
  background: color-mix(in oklab, var(--clr-accent), transparent 53%);
  transition: width .7s ease;
}

.project-container li .icon {
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-top: 15px solid var(--clr-primary);
  transform: rotate(-90deg) translateY(-35px) scale(.425);
  display: inline-block;
  transition: transform .2s ease .5s, border-top-color .2s ease .5s;
}

/* Hover underline + icon motion */
.project-container li a:hover h2::after {
  width: 102%;
}

.project-container li a:hover .icon {
  transform: rotate(-90deg) translateY(-15px) scale(.425);
  border-top-color: var(--clr-accent);
}

/* Gated tag */
.gated-message {
  font-style: italic;
  color: var(--clr-muted);
  margin: 0 0 5px;
  font-size: 1rem;
}

/* ---------- Modal (image viewer) ---------- */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .8);
  justify-content: center;
  align-items: start;
  overflow: auto;
  padding: 50px;
}

.image-modal img {
  max-width: 80%;
  width: 1000px;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0, 0, 0, .7);
  border-radius: 8px;
}

/* ---------- Notices (used by JS error states) ---------- */

dt, dd {
  display: inline-block;
}

dt {
  width: 15%;
}

dd {
  width: 75%;
}

/* ---------- Notices (used by JS error states) ---------- */
.notice {
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem auto;
  width: min(100%, 800px);
}

.notice.error {
  background: #ffeceb;
  color: #8a1a12;
  border: 1px solid #f4b1aa;
}

/* ---------- Back to Top ---------- */
#topBtn {
  display: none;
  opacity: 0.8;
  position: fixed;
  right: 25px;
  bottom: 38px;
  z-index: 99;
  height: 52px;
  width: 52px;
  border-radius: 100%;
  border: none;
  outline: none;
  background-color: var(--clr-bg);
  color: var(--clr-white);
  font-weight: 700;
  font-size: 24px;
  cursor: pointer;
  padding: 11px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
  transition: background-color .2s ease;
  align-items: center;
  justify-content: center;
}

#topBtn:hover {
  opacity: 1;
}

/* ---------- Footer ---------- */
footer {
  background-color: var(--clr-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-copyright {
  font-family: var(--ff-serif);
  color: var(--clr-white);
  padding: 2rem 0;
}

.footer-code {
  font-family: "Gaegu", fantasy;
  text-align: center;
  white-space: nowrap;
  line-height: 8px;
  font-size: 16px;
  color: #ebecef;
  overflow: hidden;
  margin: 0;
  width: 100%;
}

/* ======================================================================
   Feature Queries (progressive enhancement)
   ====================================================================== */

/* Header/title/chevron scroll-linked animations */
@supports (animation-timeline: scroll()) {
  .header {
    animation: paralax-header ease-in-out forwards;
    animation-timeline: scroll();
    animation-range: 0svh 70svh;
  }
  .title {
    animation: paralax-title ease-in-out forwards;
    animation-timeline: scroll();
    animation-range: 0svh 80svh;
  }
  .title > h2 {
    animation: fade-out-h2 linear forwards;
    animation-timeline: scroll();
    animation-range: 0svh 40svh;
  }
  .chevron-box {
    animation: paralax-arrow ease-in-out forwards;
    animation-timeline: scroll();
    animation-range: 0svh 80svh;
  }
}

/* Project card view-timeline (only when supported) */
@supports (animation-timeline: view()) {
  .project-container {
    animation: view 3s ease-in-out both;
    animation-timeline: view();
    animation-range: 1svh 50svh;
  }
}

/* Static fallbacks when scroll-linked not supported */
@supports not (animation-timeline: scroll()) {
  .header {
    position: relative;
  }
  main {
    padding-top: 0;
  }
  .portfolio-switch.is-stuck {
    position: sticky;
    top: 0 !important;
    z-index: 1000;
  }
}

/* ---------- Keyframes ---------- */
@keyframes paralax-header {
  from {
    height: 100svh;
    background-color: var(--clr-accent);
    font-size: calc(4vw + 1em);
    border-bottom: 15px solid var(--clr-primary);
  }
  to {
    height: var(--header-height-min);
    background-color: var(--clr-primary);
    font-size: 1.5em;
    border-bottom: 15px solid var(--clr-bg);
  }
}

@keyframes paralax-title {
  from { transform: translateX(0); color: var(--clr-white); }
  to   { transform: translateX(-50%) translateX(9em); color: var(--clr-accent); }
}

@keyframes paralax-arrow {
  from { transform: rotate(0deg) translateY(0) scale(3); border-top-color: var(--clr-white); margin-top: 50px; }
  to   { transform: rotate(-90deg) translate(1.5em, -7em) scale(1); border-top-color: var(--clr-accent); margin-top: 0; }
}

@keyframes view {
  from { scale: .6; opacity: 0; }
  to   { scale: 1;  opacity: 1; }
}

@keyframes fade-out-h2 {
  from { opacity: 1; max-height: 5rem; visibility: visible; }
  to   { opacity: 0; max-height: 0;    visibility: hidden; }
}

/* ---------- Motion Preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .title > h2 {
    animation: none !important;
  }
  .header,
  .title,
  .chevron-box,
  .project-container {
    animation: none !important;
  }
}

/* ======================================================================
   Responsive
   ====================================================================== */
@media (max-width: 1054px) {
  .project-container {
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
  }
  .project-container ul {
    width: 90%;
  }
}

@media (max-width: 880px) {
  .about-me {
    gap: 30px;
    flex-direction: column;
    align-items: center;
  }
  .about-text {
    width: 100%;
  }
  .about-img-container {
    width: 50%;
  }
}

@media (max-width: 815px) {
  .title > h2 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .about-text {
    padding: 0;
  }
  h1 {
    font-size: 46px;
  }
  .project-container li h2 {
    font-size: 20px;
  }
}

@media (max-width: 500px) {
  .title > h2 {
    font-size: 20px;
  }
  .portfolio-switch button {
    padding: 1rem 1rem;
  }
}
