/* ============================================================
   Rania Abdelghani — personal academic site
   Direction: "Curious" — bright, warm, playful
   Palette: sunlit cream / indigo ink / coral · teal · sun
   Type: Fraunces (display) + Nunito Sans (body/ui) + mono data
   Signature: floating "?", coral swoosh, sun highlighter
   ============================================================ */

:root {
  /* surfaces */
  --paper: #fffcf7;
  --paper-raised: #ffffff;
  --paper-sunk: #fbf2e6;

  /* ink */
  --ink: #262437;
  --ink-soft: #5a5772;

  /* accents — bright versions are for DECORATION only */
  --coral: #ff5a36;         /* swoosh, floating ?, dots, borders, hovers */
  --coral-ink: #c9381a;     /* links, button fill, coral text (AA on paper) */
  --teal: #12a89d;
  --teal-ink: #0a6f63;
  --sun: #ffc24b;
  --sun-soft: #ffe3a3;
  --sun-ink: #7d5e00;      /* legible deep gold for text */
  --sun-chip: #ffeec2;     /* soft-yellow chip fill */

  /* pastel picture-frame cycle — theme-tied only */
  --frame-coral: #ffc2b0;
  --frame-teal: #a7e6de;
  --frame-sun: #ffe1a6;

  /* lines */
  --rule: #ece2d3;
  --rule-soft: #f4ecdf;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* hand-drawn coral underline (bright coral) */
  --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 18' preserveAspectRatio='none'%3E%3Cpath d='M5 12 C70 3 150 3 210 9 C250 13 275 12 295 7' fill='none' stroke='%23ff5a36' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");

  --w: 66rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1a26;
    --paper-raised: #232232;
    --paper-sunk: #201f2c;
    --ink: #efeaf3;
    --ink-soft: #a8a4bb;
    --coral: #ff7a5c;
    --coral-ink: #ff8a6b;
    --teal: #35d0c3;
    --teal-ink: #48d8cb;
    --sun: #ffce5f;
    --sun-soft: #ffe3a3;
    --sun-ink: #ffd77a;
    --sun-chip: color-mix(in srgb, var(--sun) 14%, var(--paper));
    --frame-coral: #ff9e86;
    --frame-teal: #6fd6c9;
    --frame-sun: #ffd486;
    --rule: #34324a;
    --rule-soft: #2a2839;
    --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 18' preserveAspectRatio='none'%3E%3Cpath d='M5 12 C70 3 150 3 210 9 C250 13 275 12 295 7' fill='none' stroke='%23ff7a5c' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
  }
}

/* smoothly interpolable frame colour (registered → fades instead of snapping) */
@property --frame {
  syntax: "<color>";
  inherits: false;
  initial-value: #ffe1a6;
}
@keyframes frameCycle {
  0%   { --frame: var(--frame-coral); transform: rotate(0deg); }
  16%  { transform: rotate(2deg); }
  33%  { --frame: var(--frame-teal);  transform: rotate(0deg); }
  50%  { transform: rotate(2deg); }
  66%  { --frame: var(--frame-sun);   transform: rotate(0deg); }
  83%  { transform: rotate(2deg); }
  100% { --frame: var(--frame-coral); transform: rotate(0deg); }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

/* ---------- utilities ---------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: .5rem 1rem; border-radius: 0 0 .6rem .6rem;
  font-family: var(--sans); font-size: .875rem; font-weight: 700;
  transition: top .15s ease; z-index: 20;
}
.skip-link:focus { top: 0; }

a {
  color: var(--coral-ink);
  text-decoration-color: color-mix(in srgb, var(--coral-ink) 35%, transparent);
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2.5px solid var(--coral); outline-offset: 3px; border-radius: 3px; }

/* sun-yellow highlighter marker — "a curious mind marking the page" */
.hl {
  background: linear-gradient(103deg, var(--sun-soft), var(--sun)) no-repeat;
  background-size: 100% 44%;
  background-position: 0 82%;
  padding: 0 .08em;
  border-radius: .1em;
}
@media (prefers-color-scheme: dark) {
  .hl {
    color: var(--ink);
    background: linear-gradient(transparent 58%, color-mix(in srgb, var(--sun) 42%, transparent) 0) no-repeat;
  }
}

/* ---------- nav ---------- */

.site-head {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}

.nav {
  max-width: var(--w); margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 3.4rem;
  font-family: var(--sans);
}

.nav-name {
  font-family: var(--display); font-weight: 600; font-size: 1.15rem;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
}
.nav-name:hover { color: var(--coral-ink); }

.nav-menu {
  display: flex; gap: 1.4rem; list-style: none; margin: 0; padding: 0;
}
.nav-menu a {
  position: relative;
  color: var(--ink-soft); text-decoration: none;
  font-size: .875rem; font-weight: 600;
  padding: .35rem 0;
}
.nav-menu a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.05rem;
  height: 2.5px; border-radius: 2px; background: var(--coral);
  transform: scaleX(0); transform-origin: left; transition: transform .2s ease;
}
.nav-menu a:hover { color: var(--ink); }
.nav-menu a:hover::after { transform: scaleX(1); }
.nav-menu a.active { color: var(--coral-ink); }
.nav-menu a.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none; background: none; border: 1.5px solid var(--rule);
  border-radius: .6rem; padding: .55rem .6rem; cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  content: ""; display: block; width: 1.1rem; height: 2.5px;
  background: var(--ink); border-radius: 2px; position: relative;
}
.nav-toggle-bar::before { position: absolute; top: -5px; }
.nav-toggle-bar::after  { position: absolute; top: 5px; }

/* ---------- hero ---------- */

.hero {
  padding: 4.5rem 1.25rem 3.5rem;
  background: radial-gradient(120% 85% at 88% -5%, color-mix(in srgb, var(--coral) 9%, transparent), transparent 62%);
}

.hero-inner {
  position: relative;
  max-width: var(--w); margin: 0 auto;
  display: grid; grid-template-columns: 1fr minmax(14rem, 19rem);
  gap: 3rem; align-items: center;
}
.hero-text, .hero-portrait { position: relative; z-index: 1; }

/* the signature: a big, curious question mark hanging in the air */
.floating-q {
  position: absolute; z-index: 0; top: -3.2rem; right: 2%;
  font-family: var(--display); font-style: italic; font-weight: 600;
  font-size: clamp(9rem, 20vw, 17rem); line-height: 1;
  color: var(--coral); opacity: .12; pointer-events: none;
  user-select: none;
}
@media (prefers-reduced-motion: no-preference) {
  .floating-q { animation: bob 6s ease-in-out infinite; }
  @keyframes bob {
    50% { transform: translateY(-.6rem) rotate(-3deg); }
  }
}

.kicker {
  display: inline-block;
  font-family: var(--sans); font-size: .72rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--coral-ink);
  background: color-mix(in srgb, var(--coral) 12%, var(--paper));
  padding: .3rem .7rem; border-radius: 999px;
  margin: 0 0 1.4rem;
}

.hero h1 {
  position: relative; display: inline-block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 4.1rem); line-height: 1.02;
  letter-spacing: -.02em;
  margin: 0 0 1.3rem;
}
.hero h1::after {
  content: ""; position: absolute; left: -.02em; right: -.02em; bottom: -.22em;
  height: .34em; background: var(--swoosh) no-repeat; background-size: 100% 100%;
}

.hero-role {
  font-family: var(--sans); font-size: 1rem; font-weight: 600; color: var(--ink-soft);
  margin: 0 0 1rem; max-width: 34em;
}

.hero-tagline { margin: 0 0 1.75rem; max-width: 36em; font-size: 1.12rem; }
.hero-tagline em { font-style: italic; color: var(--teal-ink); font-weight: 700; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.hero-portrait .hero-actions { margin: 1.5rem 0 0; }
.hero-portrait .hero-actions .btn { flex: 1; text-align: center; }

.btn {
  display: inline-block; font-family: var(--sans); font-size: .92rem; font-weight: 700;
  padding: .6rem 1.25rem; border-radius: 999px;
  border: 2px solid var(--rule); color: var(--ink);
  text-decoration: none; background: var(--paper-raised);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.btn-primary {
  background: var(--coral-ink); border-color: var(--coral-ink); color: #fff;
}
.btn-primary:hover {
  border-color: var(--coral-ink); transform: translateY(-2px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--coral) 40%, transparent);
}
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #201409; }
  .video-play { color: #201409; }
}

.hero-links {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none; margin: 0; padding: 0;
  font-family: var(--sans); font-size: .9rem; font-weight: 700;
}
.hero-links a {
  display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none;
}
.hero-links .icon {
  width: 1.15em; height: 1.15em; flex: none; fill: currentColor;
  transition: transform .18s ease;
}
.hero-links a:hover .icon { transform: translateY(-2px) rotate(-6deg); }
.hero-links .label {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.hero-links a:hover .label { text-decoration-thickness: 2px; }
.hero-links li:nth-child(1) a { color: var(--coral-ink); }  /* Email  */
.hero-links li:nth-child(2) a { color: var(--teal-ink); }   /* LinkedIn */
.hero-links li:nth-child(3) a { color: var(--sun-ink); }    /* Scholar */
.hero-links li:nth-child(4) a { color: var(--ink-soft); }   /* GitHub */
@media (prefers-reduced-motion: reduce) {
  .hero-links .icon { transition: none; }
  .hero-links a:hover .icon { transform: none; }
}

.hero-portrait img {
  width: 100%; height: auto; border-radius: 1rem; display: block;
  border: 3px solid var(--paper-raised);
  --frame: var(--frame-sun);
  box-shadow: 14px 14px 0 var(--frame);
}
.hero-portrait img:hover, .monogram:hover {
  animation-play-state: paused;   /* hover to freeze the colour + angle */
}

.monogram {
  aspect-ratio: 4 / 5; border-radius: 1rem;
  background: linear-gradient(150deg, var(--paper-raised), var(--paper-sunk));
  border: 3px solid var(--paper-raised);
  --frame: var(--frame-sun);
  box-shadow: 14px 14px 0 var(--frame);
  display: grid; place-content: center; position: relative; overflow: hidden;
}

/* continuous pastel frame cycle (coral → mint → sun), motion-safe */
@media (prefers-reduced-motion: no-preference) {
  .hero-portrait img, .monogram { animation: frameCycle 8s ease-in-out infinite; }
}
.monogram span:first-child {
  font-family: var(--display); font-size: 4.4rem; font-weight: 600;
  letter-spacing: .02em; color: var(--ink-soft);
}
.monogram-q {
  position: absolute; right: -.3em; bottom: -.5em;
  font-family: var(--display); font-size: 11rem; font-style: italic;
  color: var(--coral); opacity: .16; line-height: 1;
}

/* hero load-in */
@media (prefers-reduced-motion: no-preference) {
  .hero-text > * { animation: rise .6s cubic-bezier(.2,.7,.3,1) both; }
  .hero-text > *:nth-child(2) { animation-delay: .06s; }
  .hero-text > *:nth-child(3) { animation-delay: .12s; }
  .hero-text > *:nth-child(4) { animation-delay: .18s; }
  .hero-text > *:nth-child(5) { animation-delay: .24s; }
  .hero-text > *:nth-child(6) { animation-delay: .30s; }
  @keyframes rise { from { opacity: 0; transform: translateY(.6rem); } }
}

/* ---------- sections ---------- */

.section { max-width: var(--w); margin: 0 auto; padding: 3.25rem 1.25rem; border-top: 1px solid var(--rule-soft); }

.section h2 {
  font-family: var(--display); font-size: 2rem; font-weight: 600;
  letter-spacing: -.015em; margin: 0 0 1.5rem;
}
/* playful building-block marker before each heading, cycling accents */
.section h2::before {
  content: ""; display: inline-block;
  width: .55em; height: .55em; border-radius: .18em;
  margin-right: .5em; transform: translateY(-.06em) rotate(-8deg);
  background: var(--coral);
}
.section:nth-of-type(3n+2) h2::before { background: var(--teal); }
.section:nth-of-type(3n)   h2::before { background: var(--sun); }

.subhead {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--teal-ink);
  margin: 2rem 0 .85rem; font-weight: 800;
}

.section-note { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); margin: 1.25rem 0 0; }
.section h2 + .section-note { margin: -1rem 0 1.5rem; }

.prose { max-width: 46em; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); }

/* ---------- research cards ---------- */

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
}

.card {
  background: var(--paper-raised); border: 1px solid var(--rule-soft);
  border-top: 4px solid var(--coral);
  border-radius: .9rem; padding: 1.35rem 1.35rem 1.15rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:nth-child(3n+2) { border-top-color: var(--teal); }
.card:nth-child(3n)   { border-top-color: var(--sun); }
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgb(38 36 55 / 10%); }
.card h3 { font-family: var(--display); font-weight: 600; font-size: 1.2rem; margin: 0 0 .5rem; }
.card p { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); margin: 0; line-height: 1.58; }
.card em { color: var(--teal-ink); font-style: italic; font-weight: 700; }

/* ---------- publications ---------- */

.pub-year { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.pub-year h3 {
  font-family: var(--mono); font-size: .82rem; font-weight: 700;
  color: var(--coral-ink); margin: .25rem 0 0;
  background: color-mix(in srgb, var(--coral) 12%, var(--paper));
  padding: .12rem 0; border-radius: 999px; text-align: center;
  align-self: start;
}

.pub-list { list-style: none; margin: 0; padding: 0; }

.pub { padding: .7rem 0 .8rem; border-bottom: 1px solid var(--rule-soft); position: relative; }
.pub:last-child { border-bottom: none; }

.pub-title { margin: 0 0 .25rem; font-size: 1.02rem; font-weight: 700; }
.pub-title a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.pub-title a:hover { color: var(--coral-ink); }

.pub-meta { margin: 0; font-family: var(--sans); font-size: .85rem; color: var(--ink-soft); }
.pub-meta .me { font-weight: 800; color: var(--ink); }

/* ---------- talks / video ---------- */

.video-facade {
  background: linear-gradient(135deg, #2a2740 0%, #45325c 100%);
  color: #f7f3ee; border-radius: 1rem; padding: 2.5rem 2rem;
  cursor: pointer; margin-bottom: .5rem;
}
.video-facade:hover .video-play { transform: scale(1.09); }
.video-facade-inner { max-width: 34em; margin: 0 auto; text-align: center; }
.video-play {
  display: grid; place-content: center; width: 3.4rem; height: 3.4rem;
  margin: 0 auto 1rem; border-radius: 50%;
  background: var(--coral); color: #fff; font-size: 1.15rem;
  padding-left: .2rem; transition: transform .15s ease;
}
.video-title { font-family: var(--display); font-weight: 600; font-size: 1.25rem; margin: 0 0 .5rem; }
.video-note { font-family: var(--sans); font-size: .82rem; opacity: .85; margin: 0; }
.video-note a { color: inherit; }

.video-facade iframe {
  width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: .6rem; display: block;
}
.video-facade.playing { padding: 0; background: #000; cursor: default; }

.talk-list { list-style: none; margin: 0; padding: 0; max-width: 50em; }
.talk-list li {
  display: grid; grid-template-columns: 6rem 1fr; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--rule-soft); align-items: start;
}
.talk-list li:last-child { border-bottom: none; }
.talk-when {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--teal-ink); background: color-mix(in srgb, var(--teal) 12%, var(--paper));
  padding: .18rem .55rem; border-radius: 999px; justify-self: start; margin-top: .1rem;
}
.talk-what { font-family: var(--sans); font-size: .94rem; }

/* highlighter treatment reused for awards */
.award {
  font-weight: 800; color: var(--ink);
  background: linear-gradient(103deg, var(--sun-soft), var(--sun)) no-repeat;
  background-size: 100% 44%; background-position: 0 82%;
  padding: 0 .12em; border-radius: .1em;
}
@media (prefers-color-scheme: dark) {
  .award { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--sun) 42%, transparent) 0) no-repeat; }
}

/* ---------- timeline ---------- */

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  display: grid; grid-template-columns: 4.75rem 1fr; gap: 1rem;
  padding: .5rem 0 .5rem 1rem; border-left: 2.5px solid var(--rule); align-items: start;
}
.timeline li::before {
  content: ""; position: absolute; left: -.32rem; top: .8rem;
  width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--coral); box-shadow: 0 0 0 3px var(--paper);
}
.timeline .tl-when {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--coral-ink); background: color-mix(in srgb, var(--coral) 12%, var(--paper));
  padding: .18rem .5rem; border-radius: 999px; justify-self: start; margin-top: .05rem;
}
.timeline div { font-family: var(--sans); font-size: .93rem; line-height: 1.5; }

/* Experience & Education leans yellow, matching its section marker */
#experience .subhead { color: var(--sun-ink); }
#experience .tl-when { color: var(--sun-ink); background: var(--sun-chip); }
#experience .timeline li::before { background: var(--sun); }

/* ---------- resources page ---------- */

.section-first { border-top: none; padding-bottom: 0; }

.resource {
  background: var(--paper-raised); border: 1px solid var(--rule-soft);
  border-left: 4px solid var(--coral);
  border-radius: .9rem; padding: 1.6rem 1.6rem 1.35rem;
  margin-bottom: 1.35rem; max-width: 50em;
}
.section:nth-of-type(3n+2) .resource { border-left-color: var(--teal); }
.section:nth-of-type(3n)   .resource { border-left-color: var(--sun); }
.resource h3 { font-family: var(--display); font-weight: 600; font-size: 1.28rem; margin: 0 0 .35rem; }
.resource p { margin: 0 0 .5em; }
.resource-meta {
  font-family: var(--sans); font-size: .85rem; color: var(--ink-soft);
  margin: 0 0 .9rem; font-weight: 600;
}
.resource-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.1rem; }
.resource .video-facade { margin-top: 1.1rem; padding: 1.75rem 1.5rem; }

/* ---------- contact / footer ---------- */

.email-slot a { font-weight: 800; }

.site-foot {
  border-top: 1px solid var(--rule-soft); margin-top: 3rem;
  padding: 2rem 1.25rem 2.5rem; text-align: center;
  font-family: var(--sans); font-size: .88rem; color: var(--ink-soft);
}
.site-foot p { max-width: var(--w); margin: 0 auto .4rem; }
.site-foot a { font-weight: 700; }
.foot-note { font-size: .82rem; opacity: .85; }

/* ---------- responsive ---------- */

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: .5rem 1.25rem 1rem;
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { display: block; padding: .55rem 0; font-size: 1rem; }
  .nav-menu a::after { display: none; }

  .hero { padding-top: 2.5rem; }
  .hero-inner { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-portrait { order: -1; max-width: 12.5rem; }
  .hero-portrait img, .monogram { box-shadow: 10px 10px 0 var(--frame); }
  .floating-q { top: -2rem; right: 4%; opacity: .1; }

  .twocol { grid-template-columns: 1fr; gap: 1.5rem; }
  .pub-year { grid-template-columns: 1fr; gap: .4rem; }
  .pub-year h3 { justify-self: start; padding: .12rem .7rem; }
  .talk-list li { grid-template-columns: 5rem 1fr; gap: .75rem; }
}

/* ---------- print ---------- */

@media print {
  .site-head, .video-facade, .hero-actions, .skip-link, .floating-q { display: none; }
  body { font-size: 11pt; background: #fff; color: #000; }
  .hero { background: none; }
  .hero-portrait img, .monogram { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
