/* ============================================
   Ibrahim Alotaibi — shared stylesheet
   minimal · monochrome · markdown-flavored

  Used it? Don’t forget to thank me :)
   ============================================ */

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

:root {
  --ink: #0a0a0a;
  --ink-soft: #1a1a1a;
  --ink-muted: #6b6b6b;
  --ink-faint: #b8b8b8;
  --paper: #fafaf7;
  --rule: #e6e6e0;

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --max: 760px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02";
}

::selection { background: var(--ink); color: var(--paper); }

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

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 4rem) var(--gutter) 6rem;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 2rem;
  letter-spacing: 0.02em;
  flex-wrap: wrap;
}
.crumb .dot {
  width: 8px; height: 8px;
  background: var(--ink);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.crumb .path { color: var(--ink); }

nav.primary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 4rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  flex-wrap: wrap;
  letter-spacing: 0.02em;
}
nav.primary a {
  position: relative;
  color: var(--ink-muted);
  transition: color 0.2s ease;
  padding-bottom: 2px;
}
nav.primary a::before {
  content: "/";
  margin-right: 0.4em;
  color: var(--ink-faint);
}
nav.primary a:hover { color: var(--ink); }
nav.primary a.active {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}

.h-mark {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.8vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  font-variation-settings: "opsz" 144;
}
h1 em { font-style: italic; font-weight: 300; }

h2 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
h2::before {
  content: "##";
  color: var(--ink-faint);
  font-weight: 400;
}

h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  font-variation-settings: "opsz" 36;
}

section { margin-top: 4rem; }
section:first-of-type { margin-top: 0; }

.tagline {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 60ch;
}
.tagline .accent {
  background: var(--ink);
  color: var(--paper);
  padding: 0 0.35em;
}

/* ============ PROSE BLOCK ============ */
.prose {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 62ch;
  font-variation-settings: "opsz" 36;
}
.prose strong { font-weight: 500; color: var(--ink); }
.prose + .prose { margin-top: 1.25rem; }

.block {
  padding: 1.6rem 0;
  border-top: 1px solid var(--rule);
  transition: padding 0.3s ease;
}
.block:last-child { border-bottom: 1px solid var(--rule); }
.block:hover { padding-left: 0.5rem; }

.block-line1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.block-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.block-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.block-org {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 0.65rem;
  letter-spacing: 0.02em;
}
.block-org::before { content: "@ "; opacity: 0.5; }

.block-desc {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 62ch;
}
.block-desc + .block-desc { margin-top: 0.65rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule);
  color: var(--ink);
  transition: all 0.2s ease;
  cursor: default;
  letter-spacing: 0.02em;
}
.tag:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.tag.solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.bullets {
  list-style: none;
  display: grid;
  gap: 0.85rem;
}
.bullets li {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  padding-left: 1.5rem;
  position: relative;
}
.bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-faint);
}
.bullets li strong {
  color: var(--ink);
  font-weight: 500;
}


.terminal {
  --t-bg:      #0a0a0a;
  --t-fg:      #d4d4d4;
  --t-green:   #50fa7b;
  --t-red:     #ff5555;
  --t-cyan:    #8be9fd;
  --t-yellow:  #f1fa8c;
  --t-muted:   #6272a4;

  background: var(--t-bg);
  color: var(--t-fg);
  padding: 1.5rem 1.75rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  margin: 1.5rem 0;
  position: relative;
  overflow: auto;
}
#terminal {
  min-height: 12rem;
  max-height: 60vh;
}
.term-out { margin: 0; }
.term-out pre.term-static {
  font: inherit;
  color: inherit;
  margin: 0;
  white-space: pre;
}
.term-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-line.cmd::before {
  content: "$ ";
  color: var(--t-green);
  font-weight: 500;
}
.term-line.err   { color: var(--t-red); }
.term-line.ok    { color: var(--t-green); }
.term-line.muted { color: var(--t-muted); font-style: italic; }
.term-out .comment { color: var(--t-muted); }
.term-out .key     { color: var(--t-cyan); font-weight: 500; }
.term-out .val     { color: var(--t-yellow); }

.term-form {
  display: flex;
  gap: 0.5ch;
  align-items: baseline;
  margin-top: 0.25em;
}
.term-form[hidden] { display: none; }
.term-prompt {
  color: var(--t-green);
  font-weight: 500;
  user-select: none;
}
.term-input {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--t-fg);
  font: inherit;
  caret-color: var(--t-green);
  padding: 0;
  min-width: 0;
}
.term-input::placeholder {
  color: var(--t-muted);
  font-style: italic;
}
.terminal a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s ease;
}
.terminal a:hover,
.terminal a:focus-visible { text-decoration-color: currentColor; }

.snake-game {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.snake-screen {
  align-self: center;
  position: relative;
  background: #050a08;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow: hidden;
  max-width: 100%;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.85),
    inset 0 0 4px rgba(80, 250, 123, 0.12),
    0 0 0 6px #0c0c0c,
    0 0 0 7px #2a2a2a,
    0 14px 30px rgba(0, 0, 0, 0.55);
}
.snake-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}
.snake-game pre {
  font: inherit;
  color: inherit;
  margin: 0;
  white-space: pre;
  line-height: 1.35;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
  text-shadow: 0 0 6px currentColor;
  animation: crt-glow 4s ease-in-out infinite;
}
@keyframes crt-glow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.97; }
}
.snake-game .snake-body { color: var(--t-green); }
.snake-game .snake-food { color: var(--t-yellow); }
.snake-game .game-over  { color: var(--t-red); font-weight: 500; }
.snake-status {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 13px;
  justify-content: center;
}
.snake-hint {
  color: var(--t-muted);
  font-style: italic;
  font-size: 0.9em;
  text-align: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 1.5rem 0;
}
.stat {
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: none; }
.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  font-variation-settings: "opsz" 144;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-list {
  list-style: none;
  display: grid;
  gap: 0.85rem;
}
.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 14px;
  flex-wrap: wrap;
}
.contact-list .label {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-width: 90px;
}
.contact-list a {
  border-bottom: 1px solid var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
  padding: 1px 4px;
  margin: -1px -4px;
}
.contact-list a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ============ EDU ROW ============ */
.edu {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.edu-degree {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}
.edu-degree small {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.02em;
}
.edu-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

.next-page {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 1rem;
}
.next-page .label {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.next-page a {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  transition: all 0.2s ease;
}
.next-page a::after {
  content: " →";
  display: inline-block;
  transition: transform 0.2s ease;
}
.next-page a:hover::after {
  transform: translateX(4px);
}

footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer .sig {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
footer .caret {
  color: var(--ink);
  animation: blink 1.2s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.fade {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.7s ease forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
.fade.d1 { animation-delay: 0.05s; }
.fade.d2 { animation-delay: 0.15s; }
.fade.d3 { animation-delay: 0.25s; }
.fade.d4 { animation-delay: 0.35s; }
.fade.d5 { animation-delay: 0.45s; }
.fade.d6 { animation-delay: 0.55s; }
.fade.d7 { animation-delay: 0.65s; }

@media (max-width: 600px) {
  nav.primary { gap: 1rem; margin-bottom: 2.5rem; }
  nav.primary a { font-size: 12px; }
  section { margin-top: 3rem; }
  .block-line1 { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .block-meta { font-size: 10.5px; }
  .edu { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .contact-list .label { min-width: 70px; }
  .prose { font-size: 1.02rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-last-child(-n+2):nth-child(odd):last-child { border-bottom: none; }
  .stat:nth-last-child(-n+2) { border-bottom: none; }
  .next-page a { font-size: 1.2rem; }
}

/* ============ DARK MODE ============ */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f0;
    --ink-soft: #e0e0d8;
    --ink-muted: #8a8a82;
    --ink-faint: #3a3a36;
    --paper: #0a0a0a;
    --rule: #1f1f1c;
  }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .crumb .dot,
  footer .caret,
  .snake-game pre {
    animation: none;
  }
}
