/* =====================================================
   RIHAN MOHAMED K - PORTFOLIO - style.css
   Every block looks like:  .name { property: value; }
   Easy edits: colours and fonts are in the first block.
   ===================================================== */


/* ---------- 1. COLOURS, FONTS, SPACING (edit here first) ---------- */
:root {
  --bg: #ffffff;        /* page background */
  --ink: #0a0a0a;       /* main text */
  --grey: #8a8a8a;      /* muted text */
  --line: #e3e3e3;      /* thin divider lines */
  --placeholder: #f1f1f1;

  --serif: 'Instrument Serif', Georgia, serif;   /* big headings */
  --sans: 'Inter', sans-serif;                   /* small text */

  --pad: clamp(1.25rem, 5vw, 4.5rem);            /* side spacing */
  --ease: cubic-bezier(.2, .7, .2, 1);           /* animation feel */
}


/* ---------- 1b. DARK MODE COLOURS ---------- */
/* same variables, flipped: black page, white text */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --ink: #ffffff;
  --grey: #8a8a8a;
  --line: #2a2a2a;
  --placeholder: #1a1a1a;
  color-scheme: dark;
}


/* ---------- 2. BASIC RESET ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

ul {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* negative highlight when you select or copy text: white on black */
::selection {
  background: var(--ink);
  color: var(--bg);
}

img::selection {
  background: transparent;
}


/* ---------- 3. FLOATING SECTION INDEX ---------- */
.index {
  position: fixed;
  left: var(--pad);
  bottom: 1.5rem;
  z-index: 40;
  display: flex;
  gap: .75rem;
  font-size: .8rem;
  color: var(--grey);
  transition: opacity .18s, transform .18s;
}

.index__num {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* added by script.js while the label changes */
.index.swap {
  opacity: 0;
  transform: translateY(6px);
}


/* ---------- 4. HERO ---------- */
.hero {
  min-height: 100svh;
  padding: 6rem var(--pad) 4rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2rem;
}

/* name on the left, photo frame on the right */
.hero__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}

.hero__name {
  font: 400 clamp(4rem, 14vw, 13rem)/.88 var(--serif);
  letter-spacing: -.03em;
}

/* your single photo, inside a thin frame */
.photo {
  flex-shrink: 0;
  width: clamp(150px, 22vw, 320px);
  padding: .5rem;
  border: 1px solid var(--line);
}

.photo__box {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--placeholder);
  overflow: hidden;
}

.photo__box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: .8rem;
  color: var(--grey);
}

/* the three social links */
.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.75rem;
  font: italic 400 clamp(1.4rem, 2.6vw, 2.2rem)/1.1 var(--serif);
}

.hero__links a {
  color: var(--grey);
  border-bottom: 1px solid transparent;
  transition: color .3s, border-color .3s;
}

.hero__links a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.hero__meta {
  font-size: .85rem;
  color: var(--grey);
  display: flex;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.hero__clock {
  font-variant-numeric: tabular-nums;
}

/* page-load entrance: each part rises in one after another */
.js .rise {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.ready .rise {
  opacity: 1;
  transform: none;
}

.hero .rise:nth-child(2) { transition-delay: .15s; }
.hero .rise:nth-child(3) { transition-delay: .3s; }


/* ---------- 5. SECTIONS (shared) ---------- */
.section {
  padding: 7rem var(--pad) 3rem;
}

.section__title {
  font: 400 clamp(2.2rem, 5vw, 4rem)/1 var(--serif);
  letter-spacing: -.02em;
  margin-bottom: 3rem;
}

/* scroll reveal (script.js adds .in) */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}

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


/* ---------- 6. SELECTED WORK ---------- */
.projects {
  border-top: 1px solid var(--line);
}

.project {
  display: grid;
  grid-template-columns: 3rem 1.2fr 2fr 1fr 4rem;
  gap: 0 1.5rem;
  align-items: baseline;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
  transition: opacity .4s;
}

/* fade the other rows while one is hovered */
.projects:hover .project {
  opacity: .3;
}

.projects:hover .project:hover {
  opacity: 1;
}

.project__num {
  font-size: .8rem;
  color: var(--grey);
  transition: transform .4s var(--ease), color .4s;
}

.project__title {
  font: 400 clamp(1.8rem, 3.2vw, 2.8rem)/1.05 var(--serif);
  transition: transform .5s var(--ease);
}

.project__desc {
  font-size: .9rem;
  color: var(--grey);
  max-width: 34rem;
}

.project__cat,
.project__year {
  font-size: .85rem;
}

.project__year {
  text-align: right;
  color: var(--grey);
}

.project:hover .project__title {
  transform: translateX(14px);
}

.project:hover .project__num {
  transform: translateX(6px);
  color: var(--ink);
}


/* ---------- 7. PROJECT PREVIEW ---------- */
/* desktop: floats near the cursor */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 45;
  width: 280px;
  aspect-ratio: 4 / 3;
  background: var(--placeholder);
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .5s var(--ease);
}

.preview.show {
  clip-path: inset(0);
}

.preview span,
.thumb span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: .8rem;
  color: var(--grey);
}

.preview img,
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* touch devices: tap a project to open its image inline */
.thumb {
  display: none;
  position: relative;
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
  margin-top: 1.25rem;
  background: var(--placeholder);
  overflow: hidden;
}

.open > .thumb {
  display: block;
  animation: thumb-in .4s var(--ease);
}

@keyframes thumb-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}


/* ---------- 8. RECOGNITION ---------- */
.awards {
  border-top: 1px solid var(--line);
}

.award {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem 3rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}

.award__title {
  font: 400 1.5rem/1.2 var(--serif);
}

.award__text {
  font-size: .95rem;
  color: var(--grey);
  max-width: 38rem;
}


/* ---------- 9. ABOUT ---------- */
.about {
  max-width: 40rem;
  font: 400 1.35rem/1.5 var(--serif);
  display: grid;
  gap: 1.25rem;
}


/* ---------- 10. SKILLS ---------- */
.skills {
  border-top: 1px solid var(--line);
}

.skills dt {
  font-size: .85rem;
  color: var(--grey);
  padding-top: 1.5rem;
}

.skills dd {
  font: 400 clamp(1.2rem, 2vw, 1.6rem)/1.4 var(--serif);
  padding: .4rem 0 1.5rem;
  max-width: 44rem;
  border-bottom: 1px solid var(--line);
}


/* ---------- 11. FOOTER ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem var(--pad) 4rem;
  margin: 0 var(--pad);
  padding-left: 0;
  padding-right: 0;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--grey);
}

.footer__top {
  transition: color .3s, transform .3s var(--ease);
}

.footer__top:hover {
  color: var(--ink);
  transform: translateY(-3px);
}


/* ---------- 12. TOUCH DEVICES (tap hint) ---------- */
.tap-hint {
  display: none;
  margin: -2rem 0 1.5rem;
  font-size: .85rem;
  color: var(--grey);
}

@media (hover: none) {
  .tap-hint {
    display: block;
  }
}


/* ---------- 13. DESKTOP MOUSE ONLY (recognition hover) ---------- */
@media (hover: hover) and (pointer: fine) {
  /* fade the other awards while one is hovered */
  .awards:hover .award {
    opacity: .3;
  }

  .awards:hover .award:hover {
    opacity: 1;
  }

  .award__title {
    transition: transform .5s var(--ease);
  }

  .award:hover .award__title {
    transform: translateX(14px);
  }
}


/* ---------- 14. TABLET AND MOBILE ---------- */
@media (max-width: 800px) {
  /* photo goes above the name on small screens */
  .hero__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .photo {
    order: -1;
    width: 44vw;
  }

  .project {
    grid-template-columns: 2rem 1fr auto;
    gap: .5rem 1rem;
  }

  .project__desc {
    grid-column: 2 / -1;
  }

  .project__cat {
    grid-column: 2;
    color: var(--grey);
  }

  .project__year {
    grid-column: 3;
  }

  /* no hover on phones, so keep every row fully visible */
  .projects:hover .project {
    opacity: 1;
  }

  .award {
    grid-template-columns: 1fr;
  }

  .index {
    bottom: 1rem;
  }

  .hero__meta {
    flex-wrap: wrap;
  }

}


/* ---------- 15. REDUCED MOTION (accessibility) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}


/* ---------- 16. DARK MODE BUTTON (top right) ---------- */
.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: var(--pad);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: .8rem;
  color: var(--grey);
  transition: color .3s, border-color .3s;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink);
}
