/* savisolutions.com root: a portfolio of projects. Light and dark, readable on a phone.
   Layout: logo header, then a filterable grid of project cards; each card opens a <dialog> with the details. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(assets/fonts/archivo-latin.woff2) format("woff2");
}

:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --tile: #e8eef3;
  --ink: #15212c;
  --muted: #586773;
  --line: #dce3e9;
  --brand: #2c5d80;      /* the logo's steel blue */
  --brand-ink: #ffffff;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.05), 0 10px 28px rgba(16, 32, 48, 0.08);
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1d29;
    --surface: #13263a;
    --tile: #1a3042;
    --ink: #e4ebf1;
    --muted: #a0b2c1;
    --line: #24384a;
    --brand: #84b5da;
    --brand-ink: #0f1d29;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
img { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* header */
.site-header { padding-block: 56px 40px; }
.site-header .wrap { display: grid; gap: 18px; }
.logo { display: block; width: min(420px, 100%); height: auto; mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
  /* The logo is a JPEG on white: invert it to light-on-black, then drop the black. */
  .logo { filter: invert(1) hue-rotate(180deg) brightness(1.15); mix-blend-mode: screen; }
}
.lede { font-size: clamp(18px, 2.4vw, 21px); max-width: 44ch; color: var(--muted); }
.lede strong { color: var(--ink); font-weight: 600; }

/* projects */
.projects-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 8px 20px; border-top: 1px solid var(--line); padding-top: 28px; }
h2 { font-size: 28px; font-weight: 720; font-stretch: 92%; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: 600 14px/1 var(--body); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.filters button:hover { color: var(--ink); border-color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.card { position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card:has(.open:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
.thumb { position: relative; aspect-ratio: 1 / 1; background: var(--tile); overflow: hidden; }
.thumb img { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); object-fit: contain; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 6px; align-content: start; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
h3 { font-size: 18px; font-weight: 680; font-stretch: 95%; }
.open { all: unset; cursor: pointer; }
.open::after { content: ""; position: absolute; inset: 0; }   /* the whole card opens the details */
.open:focus-visible { outline: none; }
.card-body p { color: var(--muted); font-size: 15px; line-height: 1.45; }
.tags { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--brand); background: var(--tile); border-radius: 999px; padding: 3px 9px; }
.count { color: var(--muted); font-size: 14px; padding-top: 14px; }

/* project details */
dialog.detail {
  width: min(860px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  overflow: auto; overscroll-behavior: contain;
}
dialog.detail:focus-visible { outline: none; }
dialog.detail::backdrop { background: rgba(8, 16, 24, 0.55); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
@media (max-width: 680px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-media { background: var(--tile); display: grid; place-items: center; padding: 28px; }
.detail-media img { max-height: min(520px, 60vh); width: auto; object-fit: contain; border-radius: 8px; }
@media (max-width: 680px) { .detail-media img { max-height: 300px; } }
.detail-text { padding: 28px 28px 30px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.detail-text .meta { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.detail-text h3 { font-size: 26px; font-weight: 720; font-stretch: 90%; padding-right: 36px; }
.detail-text dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; }
.detail-text dt { color: var(--muted); }
.detail-text dd { margin: 0; }
.detail-text ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 15.5px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.links a { font-weight: 600; text-decoration: none; background: var(--brand); color: var(--brand-ink); border-radius: 8px; padding: 9px 14px; font-size: 15px; }
.links a:hover { filter: brightness(1.08); }
.close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}

/* tools and about */
.section { padding-block: 56px 0; }
.section h2 { margin-bottom: 16px; }
.tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-width: 760px; }
.tools li { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; font-size: 15px; }
.about p { max-width: 62ch; color: var(--muted); }

footer { margin-top: 72px; border-top: 1px solid var(--line); padding-block: 24px 40px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}
