/* Styles for index.html — Asmaa Farouq's personal site */

/* =========================================================
   1. COLORS & FONTS — change these to restyle the whole page
   ========================================================= */
:root {
  --paper: #f6f1e7;        /* page background */
  --paper-light: #fbf8f1;  /* cards, slightly lighter than the page */
  --ink: #1f2a44;          /* main text */
  --ink-soft: #55607a;     /* secondary text (dates, tags) */
  --rule: #d9cfbd;         /* thin notebook lines */
  --grid: #e9e1d2;         /* faint background grid */
  --accent: #b23a2e;       /* correction-pen red: links, notes */
  --sticky: #f8eeb4;       /* sticky note yellow */

  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --margin-col: 170px;     /* width of the margin-notes column */
}

/* =========================================================
   2. BASE
   ========================================================= */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  background-color: var(--paper);
  /* Faint graph-paper grid, drawn with a tiny SVG tile (24px squares) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M24 0H0V24' fill='none' stroke='%23e9e1d2' stroke-width='1'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p { margin: 0 0 1rem; }

a { color: var(--accent); text-underline-offset: 3px; }

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

/* Links that "draw in" an underline on hover */
.draw-link {
  position: relative;
  text-decoration: none;
}
.draw-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.draw-link:hover::after,
.draw-link:focus-visible::after { transform: scaleX(1); }

/* =========================================================
   3. PAGE LAYOUT
   Each section is a two-column "page": main text on the left,
   a margin column for handwritten notes on the right.
   ========================================================= */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--margin-col);
  column-gap: 40px;
  padding: 56px 0;
  /* Thin ruled line between sections, like a notebook page */
  border-top: 1px solid var(--rule);
  scroll-margin-top: 16px;
}

.page:first-of-type { border-top: none; }

/* Section headings: "§1 About" */
.section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 1.6rem;
  margin-bottom: 28px;
}
.section-title .num {
  color: var(--accent);
  font-weight: 500;
}

/* A row of content + its margin note, lined up side by side */
.row {
  display: contents; /* children sit directly in the .page grid */
}
.main { grid-column: 1; min-width: 0; }
.margin { grid-column: 2; }

/* =========================================================
   4. NAVIGATION
   ========================================================= */
.site-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-nav .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.nav-name {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  font-size: 0.92rem;
}
.site-nav ul a { color: var(--ink-soft); }
.site-nav ul a:hover { color: var(--accent); }
.site-nav .sym { color: var(--accent); margin-right: 2px; }

/* Menu button — hidden on wide screens, shown on phones */
.menu-check {
  /* The checkbox itself is invisible; its label is the button */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}
.menu-toggle:hover,
.menu-check:checked + .menu-toggle {
  background: var(--ink);
  color: var(--paper);
}
.menu-check:focus-visible + .menu-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Three short lines drawn with CSS (no icon font needed) */
.menu-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}
.menu-icon span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
}

/* =========================================================
   5. MARGIN NOTES (handwritten, red pen)
   ========================================================= */
.note {
  font-family: var(--font-hand);
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--accent);
  transform: rotate(-3deg);
  margin-top: 4px;
}

/* Text with a hand-drawn circle around it */
.circled {
  position: relative;
  display: inline-block;
  padding: 4px 10px;
}
.circled svg {
  position: absolute;
  inset: -6px -8px;
  width: calc(100% + 16px);
  height: calc(100% + 12px);
  overflow: visible;
}

/* Text with a hand-drawn wavy underline */
.underlined {
  position: relative;
  display: inline-block;
}
.underlined svg {
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 8px;
  overflow: visible;
}

.circled path,
.underlined path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}

/* =========================================================
   6. §1 ABOUT
   ========================================================= */
.intro {
  display: flex;
  gap: 32px;
  align-items: center;
  margin-bottom: 28px;
}

/* Circular photo. If photo.jpg is missing, the ink circle still shows. */
.photo {
  flex-shrink: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper-light);
  overflow: hidden;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.tagline {
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* Plain ink buttons */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* =========================================================
   7. §2 NOW — sticky note
   ========================================================= */
.sticky {
  max-width: 380px;
  background: var(--sticky);
  padding: 22px 26px 18px;
  transform: rotate(-1.2deg);
  box-shadow: 2px 3px 0 rgba(31, 42, 68, 0.12);
}
.sticky h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}
.sticky ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sticky li { margin-bottom: 4px; }
.sticky strong { font-weight: 600; }

/* =========================================================
   8. §3 SOFTWARE — project cards, all the same size
   ========================================================= */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;   /* every row as tall as the tallest card */
  gap: 20px;
}

.proj {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.proj:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 0 rgba(31, 42, 68, 0.08);
}

.proj-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.proj h3 { font-size: 1.2rem; }
.proj p { margin: 0; font-size: 0.95rem; }

/* Pushes the GitHub link to the bottom so links line up across cards */
.proj .draw-link {
  align-self: flex-start;
  margin-top: auto;
  font-size: 0.92rem;
}

/* Screenshot slot. Shows a dashed box until you add an image. */
.shot {
  margin: 0;
  border: 1px dashed var(--ink-soft);
  background: var(--paper);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  overflow: hidden;
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tech tags, written like small labels */
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font-size: 0.82rem;
  padding: 1px 8px;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: var(--paper);
}

/* Placeholder text you still need to fill in */
.todo { color: var(--ink-soft); font-style: italic; }

/* =========================================================
   8b. MACHINE LEARNING — competitions and projects (Competitions / Projects subheads),
       written like rows in a results log
   ========================================================= */
.subhead {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 32px 0 4px;
}

/* Each entry is a light card, matching the Software cards */
.ml-item {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  padding: 18px 20px;
  margin-top: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ml-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 0 rgba(31, 42, 68, 0.08);
}

.ml-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
}
.ml-head h4 { font-size: 1.15rem; }

/* Placing / medal, in red pen */
.result {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}

.ml-meta {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 2px 0 8px;
}
.ml-item > p:not(.ml-meta) { margin-bottom: 12px; }

.ml-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* =========================================================
   10. §5 TEACHING
   ========================================================= */
.role { margin-bottom: 28px; }
.role:last-child { margin-bottom: 0; }
.role h3 { font-size: 1.15rem; margin-bottom: 6px; }
.role ul { margin: 0; padding-left: 1.2rem; }
.role li { margin-bottom: 4px; }
.role ul + p { margin-top: 10px; }

/* =========================================================
   12. §7 TOOLBOX
   ========================================================= */
.toolbox {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 20px;
  margin: 0;
}
.toolbox dt {
  font-family: var(--font-head);
  font-weight: 600;
}
.toolbox dd { margin: 0; }

/* =========================================================
   13. FOOTER — "Let's talk"
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 56px 0 64px;
}
.site-footer h2 {
  font-size: 1.6rem;
  margin-bottom: 18px;
}
/* Email · GitHub · LinkedIn on one line (wraps only on very small screens) */
.contact {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 0;
}
.contact li { white-space: nowrap; }
/* The small dot between items */
.contact li + li::before {
  content: "·";
  color: var(--ink-soft);
  margin: 0 12px;
}

/* Small "copy" button next to the email */
.copy-btn {
  margin-left: 8px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  background: var(--paper-light);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  vertical-align: 2px;
}
.copy-btn:hover { border-color: var(--ink); color: var(--ink); }
/* After copying, the button says "copied!" in red pen */
.copy-btn.copied {
  border-color: transparent;
  background: none;
  color: var(--accent);
  font-family: var(--font-hand);
  font-size: 1.15rem;
}
.signoff {
  font-family: var(--font-hand);
  font-size: 2rem;
  color: var(--accent);
  margin: 0;
  transform: rotate(-2deg);
  display: inline-block;
}
.copyright {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 24px 0 0;
}

/* =========================================================
   14. MOBILE
   Margin notes drop out of the side column and sit inline
   under the text they belong to.
   ========================================================= */
@media (max-width: 820px) {
  body { font-size: 17px; }

  /* ---- Navigation on phones ----
     The bar disappears; only a small "Menu" button stays in the
     top-right corner (it follows you as you scroll). Tapping it
     opens a panel with your name and every section link. */
  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    border-bottom: none;
    background: transparent;
    pointer-events: none;           /* page stays clickable around the button */
  }
  .site-nav .wrap {
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
    pointer-events: auto;
  }
  .nav-name,
  .site-nav ul { display: none; }

  /* Menu open: the panel appears */
  .site-nav:has(.menu-check:checked) {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 4px 0 rgba(31, 42, 68, 0.06);
    pointer-events: auto;
  }
  .site-nav:has(.menu-check:checked) .nav-name { display: block; }
  .menu-check:checked ~ ul {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 0;
    font-size: 1rem;
    border-top: 1px solid var(--rule);
  }
  .site-nav ul a {
    display: block;
    padding: 10px 2px;
    border-bottom: 1px dashed var(--rule);
    text-decoration: none;
  }
  .site-nav ul li:last-child a { border-bottom: none; }

  .page {
    grid-template-columns: 1fr;
    padding: 44px 0;
  }
  .main, .margin { grid-column: 1; }
  .margin { margin-top: 12px; margin-bottom: 8px; }
  .note { transform: rotate(-2deg); margin-left: 6px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }

  .intro { flex-direction: column; align-items: flex-start; gap: 20px; }
  .photo { width: 110px; height: 110px; }

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

  .toolbox { grid-template-columns: 1fr; gap: 2px; }
  .toolbox dd { margin-bottom: 12px; }

}

/* Respect people who turn off animations */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
