/* =========================
   Theme
========================= */
:root{
  color-scheme: dark;

  /* Core */
  --bg: rgb(38 38 38);
  --text: rgb(226 232 240);   /* slate-200 */
  --muted: rgb(148 163 184);  /* slate-400 */
  --accent: rgb(99 102 241);  /* indigo-500 */

  /* Slate accents (for borders, surfaces, subtle separators) */
  --slate-50:  rgb(248 250 252);
  --slate-200: rgb(226 232 240);
  --slate-300: rgb(203 213 225);
  --slate-400: rgb(148 163 184);
  --slate-500: rgb(100 116 139);
  --slate-600: rgb(71 85 105);
  --slate-700: rgb(51 65 85);
  --slate-800: rgb(30 41 59);
  --slate-900: rgb(15 23 42);

  /* Surfaces */
  --surface-1: rgb(30 30 30); 	/* slightly lighter than bg */
  --surface-2: rgb(45 45 45); 	/* lighter / hover-ish / elevated */
  --surface-3: rgb(60 60 60); 	/* even lighter / hover-ish / elevated */
  --surface-4: rgb(65 65 65); 	/* even even lighter / hover-ish / elevated */

  /* Layout */
  --page-width: 1200px;
  --page-width-tight: 800px;
  --page-pad: 24px;
  --page-pad-tight: 12px;
  --content-width: 95%;		/* Imgs, vids, tables, code in articles */

  /* Type */
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --font-size: 16px;
  --line: 1.5;

  /* Mono Font */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Nav sizing */
  --nav-h: 64px;
  --nav-h-mobile: 56px;
  --nav-gap: 24px;
  --brand-gap: 14px;

  /* Borders + effects */
  --border: rgb(60 60 60);
  --border-strong: rgba(148,163,184,.28);
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  /* Interaction */
  --radius: 14px;
  --radius2: 6px;
  --focus: 0 0 0 3px rgba(99,102,241,.35);

/* Navbar is sticky, here are its size variables */
  --nav-h: 84px;
  --anchor-offset: calc(var(--nav-h) + 12px);

}

/* any element you jump to via #hash is offsetted for navbar */
:target{
  scroll-margin-top: var(--anchor-offset);
}



/* =========================
   DEBUG
========================= */
.page { 
/*  background: rgba(0, 128, 255, 0.08);
  outline: 2px solid dodgerblue;		*/
}

.container { 
/*    background: rgba(0, 128, 255, 0.08);
    outline: 1px solid red;			*/			
}

.centered {
/*  outline: 1px solid red; */
}

/* =========================
   Base Styles before applying classes
========================= */
*{ box-sizing:border-box; }
html{ font-size: var(--font-size); }

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: var(--line);
}

main{
  flex: 1; 			/* Expands to fill leftover space */
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.4px;
  line-height: 1.15;
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 2.4rem;
  margin-bottom: 1.2rem;
}

h2 {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--muted);
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--muted);
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

p{
  font-size: 1.2rem;
  line-height: 1.5;
  letter-spacing: -0.2px;
  color: var(--text);
}

/* ----- LISTS -------- */
/* Base UL/OL styling */
ul, ol{
  margin: 0.75rem 0;
  padding-left: 2rem;         /* controls indent */
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.5;
  letter-spacing: -0.3px;
}

/* Bullet/number color + spacing */
li{
  margin: 0.35rem 0;
  line-height: 1.5;
}

/* UL bullets */
ul{
  list-style: disc;
}
ul li::marker{
  color: var(--muted);            /* subtle bullets */
}

/* OL numbers */
ol{
  list-style: decimal;
}
ol li::marker{
  color: var(--muted);            /* subtle numbers */
  font-weight: 600;
}

/* Nested lists: less vertical spacing */
li > ul,
li > ol{
  margin: 0.35rem 0 0.5rem;
}

/* Links inside lists */
li a:hover{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----- DEFINITIONS -------- */
dt{
  font-size: 1.25rem;

  margin: 1rem auto;
  width: var(--content-width);

  margin-top: 2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
}

dd{
  font-size: 1.15rem;

  margin: 1rem auto;
  width: var(--content-width);

  margin-top: -0.8rem;
  margin-bottom: 2rem;

  padding-left: 1rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
}

/* ----- QUOTES -------- */
blockquote{
  width: var(--content-width);
  margin: 1.5rem auto;
  padding-left: 1.25rem;
  border-left: 3px solid var(--border);
  color: var(--slate-300);
}

blockquote p{
  font-size: 1.25rem;

  margin: 0;
  font-style: italic;
  line-height: 1.6;
}

blockquote footer{
  font-size: 1.1rem;
  margin-top: 0.5rem;
  color: var(--muted);
}

/* --------- code styling -------- */
pre{
  width: var(--content-width);
  margin: 1.25rem auto;
  padding: 1.5rem;

  background: var(--surface-1);          /* slightly darker than page */
  border: 1px solid var(--border);
  border-radius: var(--radius);

  overflow: hidden;
}

pre code{
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);

  display: block;
  white-space: pre-wrap;       /* <-- wraps long lines */
  overflow-wrap: anywhere;     /* <-- wrap even very long tokens */
  word-break: break-word;      /* fallback */

  tab-size: 2;                 /* optional */
}

/* --------- Horizontal Rule -------- */
hr{
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0.5rem;
}

/* --------- Tables -------- */
table{
  width: var(--content-width);
  margin: 1.25rem auto;
  border-collapse: collapse;
  text-align: center;

  background: var(--surface-1);
  border-radius: var(--radius);
  overflow: hidden; /* rounds corners cleanly */

  border: none;
  box-shadow: 0 0 0 1px var(--border);
}

/* Header */
thead{
  background: var(--surface-2);
}

th{
  padding: 10px 16px 10px 16px;		/* top, right, bottom, left */

  font-size: 1.1rem;
  font-weight: 700;

  color: var(--text);
  border-bottom: 1px solid var(--border-strong);
}

/* Body cells */
td{
  font-size: 1.1rem;
  padding: 8px 16px 8px 16px;		/* top, right, bottom, left */

  color: var(--slate-300);
  border-bottom: 1px solid var(--border);
}

/* Vertical divider between columns  */
th + th,	/* Every column except first */
td + td{
  border-left: 1px solid var(--border);
}

/* Remove last row border */
tbody tr:last-child td{
  border-bottom: none;
}


/* Audio Files */
audio{
  display: block;
  width: min(100%, 480px);
  margin: 1.5rem auto;

  padding: 4px;
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--border);
}



/* =========================
   Default Styles - Mobile breakpoint
========================= */
@media (max-width: 720px){
  html{
    font-size: 12px;
  }

  h1 {
    font-size: 2.2rem;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
  
  h4 {
    font-size: 1.3rem;
  }
  p{
    font-size: 1.3rem;
  }

  /* Lists */
  ul, ol{
    font-size: 1.3rem;
  }

  /* Quotes */
  blockquote p{
    font-size: 1.3rem;
  }
  blockquote footer{
    font-size: 1.2rem;
  }

  /* Definitions */
  dt{
    font-size: 1.4rem;
  }
  dd{
    font-size: 1.25rem;
  }

  /* Code */
  pre{
  }
  
  pre code{
    font-size: 1.1rem;
  }
}

/* =========================
   Default links
========================= */
a{
  color: inherit;    
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 400;
  transition: color 0.15s ease, font-weight 0.15s ease;
}

a:hover{
  color: var(--accent);   /* slightly more purple-blue */
}

a *{
  text-decoration: none;
}

/* =========================
   Base Containers for placement
========================= */
/* Page wrappers */
.page{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.center-screen{
  min-height: 100vh;        /* full viewport height */
  display: grid;
  place-items: center;      /* vertical + horizontal centering */
}

.container{
  width: min(100%, var(--page-width));		/* 1200px */
  margin-inline: auto;
  padding-inline: var(--page-pad);		/* 24px */
}

.container-tight{
  width: min(100%, var(--page-width));
  margin-inline: auto;
  padding-inline: var(--page-pad-tight);	/* 12px */
}

.container-top{
  width: min(100%, var(--page-width));		/* 1200px */
  margin-inline: auto;
  padding-inline: var(--page-pad);		/* 24px */
  margin-top: 0px
}

.container-800px{
  width: min(100%, var(--page-width-tight));	/* 800px */
  margin-inline: auto;
  padding-inline: var(--page-pad);		/* 24px */
  margin-top: 0px
}

.container-95pct{
  width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--page-pad);		/* 24px */
}

.container-dynamic{
  width: min(100%, var(--page-width));
  margin-inline: auto;
  padding-inline: var(--page-pad);		/* 24px --> 12px mobile */
}

/* Utilities to center */
.left{
  text-align: left;
}

.tight{
  max-width: 1000px;
  margin-inline: auto;
}

/* =========================
   Container - Mobile breakpoint
========================= */
@media (max-width: 720px){
  .container-dynamic{
    width: min(100%, var(--page-width));
    margin-inline: auto;
    padding-inline: var(--page-pad-tight);	/* --> 12px */
  }

  .container-top{
    margin-top: -10px
  }

  .container-800px{
    margin-top: -10px
  }
}

/* =========================
   Utilities for images
========================= */
.centered{
  display: block;          	/* allows margin auto */
  margin: 12px auto;       	/* 12px top/bottom, centered horizontally */
  width: var(--content-width);         		/* responsive */
  height: auto;            	/* keep aspect ratio */
}

.icon-text{
  display: flex;
  align-items: center;   	/* vertical alignment */
  gap: 8px;             	/* space between photo and text */
  margin-top: -8px;
  margin-bottom: 18px;
}

.caption{
  margin: 0px auto 12px;
  max-width: 100%;
  font-size: 1.1rem;
  text-align: center;
  font-style: italic;
  color: var(--muted);   
}

@media (max-width: 720px){
  .caption{
    font-size: 1.2rem;
  }
}


/* =========================
   Utilities for videos
========================= */
.video {
  display: block;
  margin: 12px auto;          /* same vertical spacing and horizontal centering as your images */
  max-width: 100%;             /* responsive, won't overflow container */
  width: var(--content-width);                 
  aspect-ratio: 16 / 9;        /* maintains 16:9 ratio (perfect for YouTube) */
  position: relative;
  overflow: hidden;
}

.youtube-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;                   /* equivalent to frameborder="0" */
}


/* =========================
   Card
========================= */
.card{
  position: relative;
  display: grid;
  gap: 28px;
  margin: 1.2rem auto;
  max-width: 1000px;

  background: var(--surface-3);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius2);

  overflow: hidden;
  text-align: left; /* keep text left inside card even if page is centered */

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

/* Right content */
.card-body{
  display: grid;
  grid-template-columns: 360px 1fr;
  grid-template-areas:
    "media header"
    "media meta";
  gap: 18px;
  align-items: start;
  height: 100%;                  /* so children can stretch */
}

.card-header{
  grid-area: header;
}

/* Whole card clickable */
.card-link{
  display: block;
  align-items: stretch;          /* stretch rows */
  height: 100%;
  width: 100%;

  grid-template-columns: inherit;
  grid-template-areas: inherit;
  gap: inherit;
  color: inherit;
  text-decoration: none;

  padding: 6px;
}

/* Keep real content above link for selection if needed */
.card > *{
  position: relative;
  z-index: 2;
}

/* Left media on desktop */
.card-media{
  grid-area: media;

  /* cancel the link padding so the image touches card edges */
  margin: -6px;
  margin-right: 0;               /* keep the inner gap to the right column */

  /* left side rounded, right side straight */
  border-top-left-radius: var(--radius2);
  border-bottom-left-radius: var(--radius2);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;

  align-self: stretch;
}

.card-media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title{
  margin: 0;
  margin-top: 16px;
  margin-left: 8px;
  margin-right: 26px;
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.3px;
  color: var(--text);
}

.card-subtitle{
  margin: 6px 0 0;
  margin-left: 8px;
  margin-right: 26px;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

/* Bottom row */
.card-meta{
  margin-top: auto; /* pushes meta to bottom */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  padding-top: 8px;
  padding-bottom: 12px;
  padding-left: 14px;
  padding-right: 24px;

  color: var(--muted);
  font-size: 1rem;
  grid-area: meta;
}

.card-meta-left{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-meta-icon{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}

.card-readtime{
  font-size: 0.9rem;
  white-space: nowrap;
}

.card-date{
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Hover (subtle, not flashy) */
.card:hover{
  border-color: var(--border-strong);
  background: var(--surface-4);
  border-color: var(--border-strong);
  background: var(--surface-4);
  transform: translateY(-2px) scale(1.01);
}

/* Keyboard focus */
.card:has(.card-link:focus-visible){
  outline: none;
  box-shadow: var(--shadow), var(--focus);
}

/* =========================
   Card - Mobile breakpoint
   Stack image between subtitle and meta
========================= */
@media (max-width: 720px){
  .card{
    grid-template-columns: 1fr;
  }

  .card-link{
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 4px;
    padding-bottom: 0px;
  }

  .card-body{
    display: flex;
    flex-direction: column;
  }

  .card-title{
    font-size: 1.4rem;
    margin-right: 12px;		/* proper wrapping in card */
    padding: 0px;
  }

  .card-subtitle{
    font-size: 1.3rem;
    margin-right: 12px;
    padding-left: 0px;
    padding-right: 0px;
  } 

  .card-readtime{
    font-size: 1.1rem;
  }
  .card-date{
    font-size: 1.1rem;
  }

  .card-media{
    min-height: 100px;
    border-radius: var(--radius2);
    grid-area: media;
    margin-left: 8px;      
    margin-right: 8px;      
    margin-top: -6px;      
    margin-bottom: -6px;      
    overflow: hidden;
  }

  .card-meta{
    display: flex;
    align-items: center;
    justify-content: space-between; /* pushes date to the far right */
    gap: 12px;
    width: 100%;

    padding-left: 10px;
    padding-right: 14px;
    padding-top: 0px;
  }
}

/* =========================
   Typography - Classes to apply to the base to style further
========================= */
.title{
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
  margin: 0;
}

.subtitle{
  margin-top: 0.5rem;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--muted);
}

.subsubtitle{
  margin-top: 0.5rem;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--muted);
}

.small{
  margin: 0;
  font-size: 1rem;
  color: var(--slate-500);
}

.article-date{
  margin: 0;
  font-size: 1rem;
  margin-top: -22px;
  margin-bottom: 24px;
  margin-left: 16px;
  color: var(--slate-500);
}

/* =========================
   Footnotes
========================= */
.footnotes{
  margin: 1rem auto 0;
  padding-left: 1.5rem;

  font-size: 1.1rem;
  color: var(--slate-300);
}

/* Footnote numbers */
.footnotes li::marker{
  font-weight: 400;
  color: var(--accent);
}

.footnotes a{
  font-weight: 300;
  color: var(--text);
  text-decoration: underline;
}

.footnotes a:hover{
  color: var(--accent);
}


/* =========================
   Navbar (desktop)
========================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.navbar{
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nav-gap);
}

/* Brand */
.brand{
  display: inline-flex;
  align-items: center;
  gap: var(--brand-gap);
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;

}

.brand-logo{
  width: 36px;
  height: 36px;
  display: block;
}

.brand-name{
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .2px;
  font-size: 20px;

  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  transition: color .05s ease, background-color .05s ease;
}

.brand-name:hover{
  color: var(--text);
  background: rgba(148,163,184,.08);
}

/* Links */
.nav-desktop{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;          	/* scales down without a breakpoint */
  justify-content: flex-end; 	/* keeps it right aligned when wrapping */
  font-size: 18px;
}

.nav-link{
  color: var(--muted);
  text-decoration: none;
  padding: 10px 10px;
  border-radius: 10px;
  transition: color .05s ease, background-color .05s ease;
}

.nav-link:hover{
  color: var(--text);
  background: rgba(148,163,184,.08);
}

.nav-link:focus-visible{
  outline: none;
  box-shadow: var(--focus);
}

/* =========================
   Mobile menu pieces (hidden by default)
========================= */
.nav-toggle{ display:none; }
.nav-mobile{ display:none; }

/* =========================
   One breakpoint: mobile
========================= */
@media (max-width: 720px){
  .nav-desktop{ display:none; }
  .navbar{
    height: var(--nav-h-mobile);
    gap: var(--nav-gap);
  }
  .nav-toggle{ 
    display:inline-flex;
    width:40px; height:40px;
    align-items:center; justify-content:center;
    background:transparent;
    border:0px solid var(--border);
    border-radius:12px;
    color: var(--muted);
    cursor:pointer;
  }
  .nav-toggle:focus-visible{ outline:none; box-shadow: var(--focus); }
  .nav-toggle:hover{ 
    background:var(--surface-3);
    border:1px solid var(--surface-4);
  }

  .brand-name{
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .2px;
    font-size: 20px;
  
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 10px;
    transition: color .05s ease, background-color .05s ease;
  }

  /* hamburger icon (3 lines) */
  .nav-toggle-bar{
    width:20px; height:2px;
    background: currentColor;
    position:relative;
    display:block;
  }
  .nav-toggle-bar::before,
  .nav-toggle-bar::after{
    content:"";
    position:absolute;
    left:0;
    width:20px; height:2px;
    background: currentColor;
  }
  .nav-toggle-bar::before{ top:-6px; }
  .nav-toggle-bar::after{ top: 6px; }

  /* full-screen overlay menu */
  .nav-mobile{
    position: fixed;
    inset: var(--nav-h-mobile) 0 0 0;   /* below header */
    background: var(--bg);
    padding: 6px;
    display:none;               /* shown when nav-open */
    flex-direction:column;
    gap: 10px;
    font-size: 20px;
  }

  /* open state */
  html.nav-open .nav-mobile{ display:flex; }
  html.nav-open body{ overflow:hidden; } /* stop page scrolling when menu open */

  /* turn hamburger into an X when open */
  html.nav-open .nav-toggle-bar{ background: transparent; }
  html.nav-open .nav-toggle-bar::before{ top:0; transform: rotate(45deg); }
  html.nav-open .nav-toggle-bar::after{ top:0; transform: rotate(-45deg); }
}


/* =========================
   Photo Utilities
========================= */
.avatar{
  width: 192px;
  height: 192px;
  border-radius: 50%;
  object-fit: cover;

  margin-top: 50px;
  margin-bottom: 20px;
}

.social{
  display: flex;
  justify-content: center;
  gap: 8px;              /* space between icons */
  margin-top: 1.5rem;
}

.social .link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.social .icon{
  width: 42px;
  height: 42px;
  color: white;
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.social .link:hover .icon,
.social .link:focus-visible .icon{
  color: white;
  transform: scale(1.25);
}


/* =========================
   Social Icons - Mobile
========================= */
@media (max-width: 720px){
  .avatar{
    width: 192px;
    height: 192px;
    border-radius: 50%;
    object-fit: cover;

    margin-top: -60px;
    margin-bottom: 20px;
  }
  
  .social{
    display: flex;
    justify-content: center;
    gap: 8px;              /* space between icons */
    margin-top: 1.5rem;
  }
  
  .social .link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .social .icon{
    width: 32px;
    height: 32px;
    color: white;
    transition:
      transform 0.2s ease,
      color 0.2s ease;
  }

}

/* =========================
   Footer
========================= */
.site-footer{
  margin-top: 2px;
  width: 100%;
  padding: 12px 0;
}

.footer-text{
  text-align: center;
  margin: 0;
  font-size: 1rem;
  color: var(--slate-500);
}

.footer-link{
  color: inherit;
  text-decoration: none;
}

.footer-link:hover{
  color: var(--accent);
}

.footer-link:hover{
  color: var(--accent);          /* light up */
  text-decoration: underline;    /* optional */
  text-underline-offset: 2px;    /* optional, nicer */
}

