/* ============================================================
   alae-eddine-dahane.xlsx
   The portfolio is a spreadsheet: the one artifact this work
   keeps replacing. Paper-warm sheet, Excel-green selection,
   cell comments, conditional formatting, sheet-tab navigation.
   ============================================================ */

:root {
  --paper: #f7f6f1;
  --paper-dim: #efede5;
  --chrome: #ece9df;
  --gridline: #e0ddd2;
  --cellline: #cfccbf;
  --ink: #20221f;
  --muted: #70746c;
  --green: #1e7a46;
  --green-bright: #21a05a;
  --green-fill: #e2efe6;
  --link: #1155cc;
  --link-fill: #e8effb;
  --note-red: #c0392b;
  --note-fill: #fdf6c8;
  --warn-fill: #faf3d7;
  --warn-ink: #8a6d1a;
  --font-display: "Archivo Black", sans-serif;
  --font-mono: "Spline Sans Mono", monospace;
  --rowh: 36px;
  --colw: 128px;
  --gutter: 46px;
  --chrome-h: 108px;  /* titlebar 40 + formula 40 + colheader 28 */
  --tabs-h: 42px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  position: relative; /* anchors the absolutely-positioned row gutter to the full document */
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* the sheet grid */
  background-image:
    linear-gradient(var(--gridline) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
  background-size: 100% var(--rowh), var(--colw) 100%;
  background-position: 0 var(--chrome-h), var(--gutter) 0;
  padding-bottom: calc(var(--tabs-h) + 3rem);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--green); color: #fff; }

a { color: inherit; }

/* ============ workbook chrome (sticky top) ============ */

.chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--cellline);
  box-shadow: 0 1px 0 rgba(32, 34, 31, 0.04);
}

.titlebar {
  height: 40px;
  background: var(--chrome);
  border-bottom: 1px solid var(--gridline);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1rem;
  font-size: 0.8rem;
}

.titlebar__logo {
  width: 18px;
  height: 18px;
  background: var(--green);
  color: #fff;
  font-family: var(--font-display);
  font-size: 11px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  flex-shrink: 0;
}

.titlebar__name { font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar__name em { font-style: normal; color: var(--muted); }

.titlebar__right {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.titlebar__right .dot { color: var(--green-bright); }

.formulabar {
  height: 40px;
  background: var(--paper);
  border-bottom: 1px solid var(--gridline);
  display: flex;
  align-items: stretch;
  font-size: 0.85rem;
}

.namebox {
  width: var(--gutter);
  min-width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--cellline);
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
}

.fx {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.fx__label { color: var(--muted); font-style: italic; font-weight: 600; }

.fx__text { color: var(--ink); }
.fx__text .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--green);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.colheader {
  height: 28px;
  background: var(--chrome);
  display: flex;
  font-size: 0.7rem;
  color: var(--muted);
  user-select: none;
}

.colheader__corner {
  width: var(--gutter);
  flex-shrink: 0;
  border-right: 1px solid var(--cellline);
  position: relative;
}

.colheader__corner::after {
  /* the select-all triangle */
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  border-left: 10px solid transparent;
  border-bottom: 10px solid var(--cellline);
}

.colheader__cols { display: flex; flex: 1; overflow: hidden; }

.colheader__cols span {
  width: var(--colw);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--gridline);
  letter-spacing: 0.08em;
}

/* ============ row-number gutter ============ */

.gutter {
  position: absolute;
  left: 0;
  top: var(--chrome-h);
  bottom: 0;
  width: var(--gutter);
  border-right: 1px solid var(--cellline);
  background: var(--chrome);
  z-index: 1;
  font-size: 0.7rem;
  color: var(--muted);
  user-select: none;
}

.gutter span {
  display: grid;
  place-items: center;
  height: var(--rowh);
  border-bottom: 1px solid var(--gridline);
}

/* ============ sheet layout ============ */

.sheet {
  position: relative;
  margin-left: var(--gutter);
  padding: 0 1.5rem;
}

.sheet__inner { max-width: 1060px; }

section { padding: calc(var(--rowh) * 2) 0; }

/* section label styled like a typed cell */
.cell-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-fill);
  border: 1px solid var(--green);
  padding: 0.25rem 0.7rem;
  margin-bottom: 1.4rem;
}

/* ============ hero ============ */

.hero { padding-top: calc(var(--rowh) * 2); }

.hero__hello {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.hero__hello b { color: var(--ink); font-weight: 600; }

/* the selected cell holding the name */
.selected-cell {
  position: relative;
  display: inline-block;
  border: 2.5px solid var(--green-bright);
  background: #fff;
  padding: 1.1rem 1.6rem 1rem;
  margin: 0 0 1.6rem;
  box-shadow: 0 2px 0 rgba(30, 122, 70, 0.12);
}

.selected-cell::after {
  /* autofill handle */
  content: "";
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 9px;
  height: 9px;
  background: var(--green-bright);
  border: 2px solid var(--paper);
  cursor: crosshair;
}

.selected-cell h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6.2vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.selected-cell h1 .row2 { color: var(--green); display: block; }

.hero__tagline {
  max-width: 58ch;
  font-size: 1.02rem;
  color: var(--ink);
  margin-bottom: 1.8rem;
}

.hero__tagline mark {
  background: var(--note-fill);
  color: inherit;
  padding: 0 0.25em;
}

/* quick-stat cells in a row */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--cellline);
  background: #fff;
  width: fit-content;
}

.stat-row > div {
  padding: 0.55rem 1.1rem;
  border-right: 1px solid var(--cellline);
  font-size: 0.78rem;
}

.stat-row > div:last-child { border-right: none; }
.stat-row b { display: block; font-size: 1.05rem; color: var(--green); }

/* ============ projects table ============ */

.xl-table {
  background: #fff;
  border: 1px solid var(--ink);
  font-size: 0.86rem;
}

.xl-row {
  display: grid;
  grid-template-columns: 3.4rem 15.5rem 1fr 11.5rem 8.5rem;
  border-bottom: 1px solid var(--gridline);
  transition: background 0.12s ease;
}

.xl-row:last-child { border-bottom: none; }

.xl-row--head {
  background: var(--ink);
  color: var(--paper);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: sticky;
  top: var(--chrome-h);
  z-index: 5;
}

.xl-row--head .xl-cell { border-right-color: rgba(247, 246, 241, 0.25); }

.xl-cell {
  padding: 0.7rem 0.9rem;
  border-right: 1px solid var(--gridline);
  min-width: 0;
}

.xl-cell:last-child { border-right: none; }

.xl-cell--ref {
  color: var(--muted);
  font-size: 0.75rem;
  display: flex;
  align-items: flex-start;
  padding-top: 0.85rem;
}

.xl-cell--name { font-weight: 600; position: relative; }

.xl-cell--desc { color: #4c5049; }

.xl-cell--stack {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.xl-row:not(.xl-row--head):hover { background: var(--green-fill); }
.xl-row:not(.xl-row--head):hover .xl-cell--ref { color: var(--green); font-weight: 600; }

/* status = conditional formatting fills */
.status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.status--daily { background: var(--green-fill); color: var(--green); border: 1px solid #b9d8c4; }
.status--shipped { background: var(--link-fill); color: var(--link); border: 1px solid #bfd2f0; }
.status--internal { background: var(--warn-fill); color: var(--warn-ink); border: 1px solid #e4d6a5; }

/* cell comments: red corner triangle + sticky-note tooltip */
.note {
  position: absolute;
  inset: 0;
}

.note::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-left: 9px solid transparent;
  border-top: 9px solid var(--note-red);
}

.note::after {
  content: attr(data-note);
  position: absolute;
  top: -0.4rem;
  right: -1rem;
  transform: translateY(-100%);
  width: max-content;
  max-width: 260px;
  background: var(--note-fill);
  border: 1px solid #d8c76a;
  box-shadow: 3px 3px 0 rgba(32, 34, 31, 0.15);
  padding: 0.55rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
  white-space: normal;
}

.xl-cell--name:hover .note::after,
.note:focus::after { opacity: 1; }

.table-caption {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.table-caption a { color: var(--link); }

/* ============ inserted chart object ============ */

.chart-object {
  margin-top: calc(var(--rowh) * 1.5);
  background: #fff;
  border: 1px solid var(--cellline);
  box-shadow: 5px 5px 0 rgba(32, 34, 31, 0.08);
  max-width: 560px;
  position: relative;
}

/* marching ants: the chart is "copied" */
.ants {
  position: absolute;
  inset: -5px;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--green) 0 6px, transparent 6px 12px) top left / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--green) 0 6px, transparent 6px 12px) bottom left / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, var(--green) 0 6px, transparent 6px 12px) top left / 2px 100% no-repeat,
    repeating-linear-gradient(0deg, var(--green) 0 6px, transparent 6px 12px) top right / 2px 100% no-repeat;
}

/* the ants only march while you're looking at them */
.chart-object:hover .ants { animation: march 0.7s linear infinite; }

@keyframes march {
  to { background-position: 12px 0, -12px 100%, 0 -12px, 100% 12px; }
}

.chart-object__title {
  border-bottom: 1px solid var(--gridline);
  padding: 0.6rem 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-object__title b { color: var(--ink); }

.chart-object__body { padding: 1.1rem 1.2rem 1.3rem; }

.bar {
  display: grid;
  grid-template-columns: 8.5rem 1fr 2rem;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
}

.bar:last-child { margin-bottom: 0; }

.bar__track { background: var(--paper-dim); height: 18px; }

.bar__fill {
  height: 100%;
  background: var(--green);
  transform-origin: left;
  animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bar:nth-child(2) .bar__fill { background: var(--green-bright); animation-delay: 0.12s; }
.bar:nth-child(3) .bar__fill { background: #7dbb95; animation-delay: 0.24s; }

@keyframes grow { from { transform: scaleX(0); } }

.bar__num { text-align: right; color: var(--muted); }

/* ============ generic content cells ============ */

.merged-cell {
  background: #fff;
  border: 1px solid var(--cellline);
  padding: 1.4rem 1.6rem;
  max-width: 72ch;
}

.merged-cell p { margin-bottom: 1rem; }
.merged-cell p:last-child { margin-bottom: 0; }
.merged-cell b { color: var(--green); }

/* label:value cells (about profile) */
.kv {
  background: #fff;
  border: 1px solid var(--cellline);
  max-width: 620px;
}

.kv > div {
  display: grid;
  grid-template-columns: 10rem 1fr;
  border-bottom: 1px solid var(--gridline);
}

.kv > div:last-child { border-bottom: none; }

.kv dt {
  padding: 0.6rem 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--gridline);
  background: var(--paper);
}

.kv dd { padding: 0.6rem 0.9rem; font-size: 0.88rem; }
.kv dd a { color: var(--link); }

/* skills heatmap = conditional formatting color scale */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  border: 1px solid var(--cellline);
  background: #fff;
  max-width: 820px;
}

.heatmap span {
  background: #fff;
  border-right: 1px solid var(--gridline);
  border-bottom: 1px solid var(--gridline);
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap .l3 { background: #bfe0cb; font-weight: 600; }
.heatmap .l2 { background: #e0efe5; }
.heatmap .l1 { background: #f4f8f4; color: #4c5049; }

.heatmap-legend {
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.heatmap-legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 0.3rem 0 0.9rem;
  vertical-align: -1px;
  border: 1px solid var(--cellline);
  font-style: normal;
}

.heatmap-legend .s3 { background: #bfe0cb; }
.heatmap-legend .s2 { background: #e0efe5; }
.heatmap-legend .s1 { background: #f4f8f4; }

/* ============ contact ============ */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 2.5rem;
  align-items: start;
  max-width: 1000px;
}

.contact-intro h2,
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 2rem);
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.contact-intro p { color: #4c5049; margin-bottom: 1.4rem; max-width: 40ch; }

/* hyperlink cells — classic sheet-blue underline */
.link-cells { border: 1px solid var(--cellline); background: #fff; width: fit-content; }

.link-cells a {
  display: block;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--gridline);
  color: var(--link);
  text-decoration: underline;
  font-size: 0.85rem;
  transition: background 0.12s ease;
}

.link-cells a:last-child { border-bottom: none; }
.link-cells a:hover { background: var(--link-fill); }

.contact-form {
  background: #fff;
  border: 1px solid var(--ink);
}

.form-cellrow {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  border-bottom: 1px solid var(--gridline);
}

.form-cellrow label {
  padding: 0.7rem 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--gridline);
  background: var(--paper);
  display: flex;
  align-items: center;
}

.form-input,
.form-textarea {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0.7rem 0.9rem;
  width: 100%;
  resize: vertical;
}

.form-textarea { min-height: 8rem; }

.form-input:focus,
.form-textarea:focus {
  outline: 2.5px solid var(--green-bright);
  outline-offset: -2.5px;
  background: #fff;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
}

.submit-button {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  box-shadow: 3px 3px 0 rgba(32, 34, 31, 0.25);
  padding: 0.7rem 1.6rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.submit-button:hover { background: var(--green-bright); }

.submit-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(32, 34, 31, 0.25);
}

.form-status { font-size: 0.78rem; }

/* ============ sheet tabs + status bar (fixed bottom) ============ */

.sheetbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabs-h);
  background: var(--chrome);
  border-top: 1px solid var(--cellline);
  display: flex;
  align-items: stretch;
  z-index: 50;
  font-size: 0.78rem;
}

.sheetbar__tabs { display: flex; align-items: stretch; overflow-x: auto; }

.sheetbar__tabs a {
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  border-right: 1px solid var(--cellline);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.sheetbar__tabs a:hover { background: var(--paper); color: var(--ink); }

.sheetbar__tabs a[aria-current="page"] {
  background: var(--paper);
  color: var(--green);
  font-weight: 600;
  box-shadow: inset 0 3px 0 var(--green);
}

.sheetbar__plus {
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  color: var(--muted);
  border-right: 1px solid var(--cellline);
  user-select: none;
}

.sheetbar__status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 0 1.1rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
}

.sheetbar__status a { color: var(--link); text-decoration: underline; }

.sheetbar__status .ready { color: var(--green); font-weight: 600; }

/* ============ playable sheet ============ */

/* the grid is interactive: cell cursor on blank sheet, normal cursors on content */
body { cursor: cell; }
.chrome, .chrome *, .sheetbar, .sheetbar *, .sheet__inner * { cursor: auto; }
a, button, .sheetbar__tabs a, .submit-button { cursor: pointer; }

.play-hint {
  margin-top: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.play-hint b { color: var(--green); font-weight: 600; }

.user-cell {
  position: absolute;
  display: flex;
  align-items: center;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: visible; /* long values spill into empty neighbors, like real Excel */
  cursor: cell;
  z-index: 2;
}

.user-cell--formula { color: var(--green); font-weight: 600; }
.user-cell--error { color: var(--note-red); font-weight: 600; }

.user-cell--selected {
  background: var(--green-fill);
  outline: 1.5px solid var(--green-bright);
  outline-offset: -1px;
}

.colheader__corner { cursor: pointer; }
.colheader__corner:hover::after { border-bottom-color: var(--green); }
.colheader__corner.is-active { background: var(--green-fill); }
.colheader__corner.is-active::after { border-bottom-color: var(--green-bright); }

.cell-editor {
  position: absolute;
  z-index: 30;
  border: 2.5px solid var(--green-bright);
  background: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
  padding: 0 5px;
  outline: none;
  box-shadow: 0 3px 10px rgba(30, 122, 70, 0.28);
}

/* ============ responsive ============ */

@media (max-width: 900px) {
  .xl-row { grid-template-columns: 3rem 1fr 7.5rem; }
  .xl-cell--desc { grid-column: 2 / 4; border-top: 1px dashed var(--gridline); }
  .xl-cell--stack { grid-column: 2 / 3; border-top: 1px dashed var(--gridline); }
  .xl-row--head .xl-cell--desc,
  .xl-row--head .xl-cell--stack { display: none; }
  .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --gutter: 30px; --colw: 96px; }
  .namebox { min-width: 56px; }
  .titlebar__right { display: none; }
  .fx { font-size: 0.75rem; }
  .sheet { padding: 0 1rem; }
  .selected-cell { padding: 0.8rem 1rem 0.75rem; }
  .sheetbar__status .hide-s { display: none; }
  .kv > div, .form-cellrow { grid-template-columns: 1fr; }
  .kv dt, .form-cellrow label { border-right: none; border-bottom: 1px solid var(--gridline); }
}

@media (prefers-reduced-motion: reduce) {
  .fx__text .caret { animation: none; }
  .ants { animation: none; }
  .bar__fill { animation: none; }
  html { scroll-behavior: auto; }
}
