/* =========================================================
   BIHHEL — Personal site
   Design system: dark, cinematic, minimal, black/red
   ========================================================= */

/* ---- Design tokens ---- */
:root {
  --bg:          #0a0605;   /* near-black warm base */
  --bg-2:        #120a08;   /* slightly lifted panels */
  --red:         #e2392b;   /* primary accent */
  --red-soft:    #ff5a4d;   /* hover / bright accent */
  --text:        #f3ede9;   /* warm white */
  --text-muted:  #b7ada6;   /* secondary text */
  --text-dim:    #8a807a;   /* tertiary / labels */
  --line:        rgba(243,237,233,0.16);
  --line-soft:   rgba(243,237,233,0.09);

  --maxw: 1400px;
  --pad-x: clamp(24px, 6vw, 96px);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---- Utilities ---- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* =========================================================
   HEADER / NAV
   ========================================================= */
.site-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: clamp(22px, 3.5vh, 40px) 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 300;
  letter-spacing: 0.22em;
  padding-left: 0.22em;   /* balance the trailing letter-spacing */
  color: var(--text);
  white-space: nowrap;
}
.nav {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 52px);
}
.nav a {
  position: relative;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color 0.3s var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--text); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--red);
}

/* Insomnia tooltip */
.nav-tip { position: relative; }
.nav-tip .tip {
  position: absolute;
  top: calc(100% + 16px);
  right: 0;
  width: 288px;
  background: rgba(18,10,8,0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  z-index: 60;
}
.nav-tip .tip::before {
  content: "";
  position: absolute;
  top: -5px; right: 22px;
  width: 9px; height: 9px;
  background: rgba(18,10,8,0.92);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.nav-tip:hover .tip,
.nav-tip:focus-within .tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-tip .tip strong { color: var(--text); font-weight: 400; }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  width: 34px; height: 34px;
  position: relative;
  z-index: 60;
}
.nav-toggle span {
  position: absolute;
  left: 6px; right: 6px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.35s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle span:nth-child(1) { top: 12px; }
.nav-toggle span:nth-child(2) { top: 21px; }
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { transform: translateY(-4.5px) rotate(-45deg); }

/* =========================================================
   HERO (home)
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(1.15);   /* 15% brighter background image */
  z-index: 1;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(10,6,5,0.86) 0%, rgba(10,6,5,0.55) 32%, rgba(10,6,5,0.10) 62%, rgba(10,6,5,0.30) 100%),
    linear-gradient(0deg, rgba(10,6,5,0.80) 0%, rgba(10,6,5,0.10) 45%, rgba(10,6,5,0.35) 100%);
}
.hero .container {
  position: relative;
  z-index: 3;
  padding-top: 140px;
  padding-bottom: clamp(64px, 12vh, 130px);
}
.hero__inner { max-width: 640px; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 22px;
}

h1.display {
  font-size: clamp(40px, 6vw, 78px);
  font-weight: 200;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.hero__lead {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 300;
  color: var(--text);
  margin: 0 0 28px;
}
.hero__text {
  font-size: clamp(15px, 1.15vw, 17px);
  color: var(--text-muted);
  max-width: 30em;
  margin: 0 0 14px;
}
.hero__thanks {
  font-size: clamp(15px, 1.15vw, 17px);
  color: var(--text-muted);
  margin: 0 0 40px;
}

/* Text link CTA (underlined, Behance) */
.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: gap 0.35s var(--ease), color 0.35s var(--ease);
}
.cta-link .arrow { color: var(--red); transition: transform 0.35s var(--ease); }
.cta-link .dest { color: var(--text-muted); transition: color 0.35s var(--ease); }
.cta-link:hover { gap: 20px; }
.cta-link:hover .dest { color: var(--text); }
.cta-link:hover .arrow { transform: translateX(4px); }

/* =========================================================
   PAGE (About / Courses shared shell)
   ========================================================= */
.page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.page__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center right;
  filter: brightness(1.15);   /* 15% brighter background image */
  z-index: 1;
}
.page__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(10,6,5,0.92) 0%, rgba(10,6,5,0.70) 40%, rgba(10,6,5,0.20) 100%),
    linear-gradient(0deg, rgba(10,6,5,0.55) 0%, rgba(10,6,5,0.15) 40%);
}
.page__body {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 150px;
  padding-bottom: 80px;
}

/* About */
.about__title {
  font-size: clamp(52px, 9vw, 128px);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.about__hi {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 300;
  color: var(--red);
  margin: 0 0 30px;
}
.about__copy { max-width: 44ch; }
.about__copy p {
  font-size: clamp(15px, 1.15vw, 17px);
  color: var(--text-muted);
  margin: 0 0 22px;
}
.about__copy strong { color: var(--text); font-weight: 400; }

.skills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
  max-width: 820px;
}
.skills span {
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  position: relative;
}
.skills span:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -12px; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 16px;
  border-radius: 1px;
  background: var(--red);
}

/* =========================================================
   COURSES
   ========================================================= */
.section-head { margin-bottom: 54px; max-width: 640px; }
.section-head h1 {
  font-size: clamp(44px, 7vw, 92px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}
.section-head p {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--text-muted);
  margin: 0;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 900px;
}
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 34px 32px 32px;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease), background 0.4s var(--ease);
}
.card:hover {
  border-color: rgba(226,57,43,0.5);
  transform: translateY(-4px);
  background: linear-gradient(180deg, rgba(226,57,43,0.06), rgba(255,255,255,0.012));
}
.card__badge {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid rgba(226,57,43,0.4);
  border-radius: 100px;
  padding: 5px 12px;
  margin-bottom: 20px;
}
.card h3 {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}
.card p {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
}
.card__foot { margin-top: auto; padding-top: 28px; }

/* ---- Wide, stacked course cards (with background image) ---- */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 1040px;
}
.course-row {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  min-height: clamp(240px, 30vw, 330px);
  display: flex;
  align-items: center;
  transition: border-color 0.45s var(--ease), transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.course-row:hover {
  border-color: rgba(226,57,43,0.55);
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.course-row__bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center;
  transition: transform 0.7s var(--ease);
  /* background-image is set inline on each card in courses.html */
}
.course-row:hover .course-row__bg { transform: scale(1.05); }
.course-row__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(10,6,5,0.95) 0%,
    rgba(10,6,5,0.82) 36%,
    rgba(10,6,5,0.42) 66%,
    rgba(10,6,5,0.12) 100%
  );
}
.course-row__content {
  position: relative;
  z-index: 3;
  padding: clamp(28px, 4vw, 48px);
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.course-row__eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.course-row h3 {
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 300;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.course-row p {
  font-size: clamp(15px, 1.15vw, 16px);
  color: var(--text-muted);
  margin: 0 0 26px;
  max-width: 42ch;
}

@media (max-width: 640px) {
  .course-row { min-height: 380px; align-items: flex-end; }
  .course-row__overlay {
    background: linear-gradient(
      0deg,
      rgba(10,6,5,0.96) 0%,
      rgba(10,6,5,0.80) 40%,
      rgba(10,6,5,0.35) 75%,
      rgba(10,6,5,0.15) 100%
    );
  }
  .course-row__content { max-width: 100%; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  border-radius: 100px;
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  transition: all 0.35s var(--ease);
}
.btn:hover { border-color: var(--text); background: rgba(255,255,255,0.05); }
.btn--primary { border-color: var(--red); color: var(--text); }
.btn--primary:hover { background: var(--red); border-color: var(--red); }
.btn--disabled {
  opacity: 0.4;
  pointer-events: none;
  border-style: dashed;
}
.btn .arrow { color: var(--red); }
.btn--primary:hover .arrow { color: var(--text); }

/* =========================================================
   CONTACT POPUP ("Get in Touch")
   ========================================================= */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.contact-modal.is-open { opacity: 1; visibility: visible; }
.contact-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,2,2,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.contact-modal__panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, rgba(24,14,12,0.98), rgba(14,8,7,0.98));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 38px 34px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.4s var(--ease);
}
.contact-modal.is-open .contact-modal__panel { transform: translateY(0) scale(1); }
.contact-modal__close {
  position: absolute;
  top: 16px; right: 18px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  transition: color 0.25s var(--ease);
}
.contact-modal__close:hover { color: var(--text); }
.contact-modal__eyebrow {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.contact-modal__panel h3 {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.contact-modal__sub {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 26px;
  line-height: 1.6;
}
.contact-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 15px 18px;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}
.contact-option:hover {
  border-color: rgba(226,57,43,0.55);
  background: rgba(226,57,43,0.08);
  transform: translateX(3px);
}
.contact-option .arrow { color: var(--red); font-size: 15px; }
.contact-option.is-copied {
  border-color: rgba(226,57,43,0.6);
  background: rgba(226,57,43,0.12);
}
.contact-modal__email {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin: 24px 0 0;
}

/* =========================================================
   NEWSLETTER (shared) + FOOTER
   ========================================================= */
.newsletter {
  position: relative;
  z-index: 3;
  border-top: 1px solid var(--line-soft);
  background: rgba(6,3,3,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.newsletter .container {
  padding-top: 48px;
  padding-bottom: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.newsletter__text { max-width: 40ch; }
.newsletter__text h4 {
  font-size: 18px;
  font-weight: 400;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.newsletter__text p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.newsletter form {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex: 1;
  min-width: 280px;
  max-width: 460px;
}
.newsletter input[type="email"] {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 13px 20px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s var(--ease);
}
.newsletter input[type="email"]::placeholder { color: var(--text-dim); }
.newsletter input[type="email"]:focus { outline: none; border-color: var(--red); }
.newsletter button {
  background: var(--text);
  color: #140b09;
  border: none;
  border-radius: 100px;
  padding: 13px 26px;
  font-size: 14px;
  letter-spacing: 0.03em;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  white-space: nowrap;
}
.newsletter button:hover { background: var(--red); color: var(--text); }
.newsletter__note {
  width: 100%;
  font-size: 13px;
  color: var(--red-soft);
  margin: 4px 0 0;
  min-height: 0;
}

.site-footer {
  position: relative;
  z-index: 3;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
}
.site-footer .container {
  padding-top: 28px;
  padding-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .brand { font-size: 14px; letter-spacing: 0.18em; padding-left: 0.18em; }
.site-footer small { color: var(--text-dim); font-size: 13px; }
.social {
  display: flex;
  align-items: center;
  gap: 26px;
}
.social a {
  position: relative;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}
.social a:hover { color: var(--text); }
.social a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -4px;
  height: 1px;
  background: var(--red);
  transition: right 0.3s var(--ease);
}
.social a:hover::after { right: 0; }
@media (max-width: 640px) {
  .site-footer .container { flex-direction: column; align-items: flex-start; gap: 18px; }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 34px;
    background: rgba(8,4,4,0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease), visibility 0.4s;
  }
  body.nav-open .nav { opacity: 1; visibility: visible; }
  .nav a { font-size: 26px; font-weight: 200; color: var(--text); }
  .nav a.is-active::after { bottom: -8px; }

  /* Tooltip becomes inline text on mobile */
  .nav-tip .tip {
    position: static;
    width: min(80vw, 340px);
    margin: 6px auto 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    text-align: center;
    font-size: 13px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 4px 0 0;
  }
  .nav-tip .tip::before { display: none; }

  .newsletter .container { flex-direction: column; align-items: flex-start; }
  .newsletter form { max-width: 100%; }
}

@media (max-width: 480px) {
  .newsletter form { flex-direction: column; }
  .newsletter button { width: 100%; }
  .skills { gap: 12px 20px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Entrance animation */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: translateY(0); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
