/* ippi.me. Noto Sans, self-hosted. Brand: navy #162A4D, navy glow #22396A,
   amber #E8A15A, darker amber #C07A3C, white #F2F2F2. */

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Brand, the same in both themes */
  --navy: #162A4D;
  --navy-glow: #22396A;
  --navy-deep: #101F3A;
  --amber: #E8A15A;
  --crust: #C07A3C;
  --white: #F2F2F2;
  --night-text: #C9D2E1;
  --night-muted: #A3B0C6;

  /* Page ground, light theme: a cool morning blue-grey */
  --ground: #EDF0F5;
  --surface: #F8F9FB;
  --ink: #162A4D;
  --text: #2A3449;
  --muted: #56617A;
  --line: #CDD4E0;
  --link: #1F4A8C;
  --warm: #93531C;      /* darker amber, readable on the light ground */
  --focus: #C07A3C;

  --sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 66rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0D1930;
    --surface: #13223F;
    --ink: #F2F2F2;
    --text: #CBD3E0;
    --muted: #97A3B9;
    --line: #26375A;
    --link: #F0B77C;
    --warm: #E8A15A;
    --focus: #E8A15A;
    color-scheme: dark;
  }
}

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

html { background: var(--ground); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--focus); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  padding: 0.5rem 0.9rem; border-radius: 6px;
  background: var(--white); color: var(--navy); font-weight: 500;
}
.skip:focus { top: 1rem; }

/* ---- the wordmark (inline SVG, see templates/_wordmark.html) ------------ */

.wordmark { display: block; width: 100%; height: auto; overflow: visible; }

/* ---- home: the night band ---------------------------------------------- */

.night {
  color: var(--night-text);
  background:
    radial-gradient(ellipse 60% 55% at 22% 22%, var(--navy-glow) 0%, rgba(34, 57, 106, 0) 75%),
    var(--navy);
  padding: clamp(2.75rem, 6vw, 4.75rem) var(--gutter) 0;
}
.night a:not(.button) { color: var(--amber); }

.masthead { max-width: var(--measure); margin: 0 auto; }
.masthead-mark { margin: 0; width: clamp(12rem, 38vw, 28rem); color: var(--white); line-height: 0; }
.tagline {
  margin: clamp(1.25rem, 3vw, 2rem) 0 0;
  font-weight: 300;
  font-size: clamp(1.35rem, 3.3vw, 2.3rem);
  line-height: 1.2;
  color: var(--white);
  text-wrap: balance;
}

/* One orchestrated moment on load: the two dots settle onto the i's,
   then the clock's screen comes on. */
.masthead .wm-pepperoni, .masthead .wm-slice {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: settle 0.9s cubic-bezier(.2, .9, .25, 1.12) both;
}
.masthead .wm-pepperoni { animation-delay: 0.15s; }
.masthead .wm-slice { animation-delay: 0.4s; --tilt: -14deg; }
@keyframes settle {
  from { opacity: 0; transform: translateY(-80%) rotate(var(--tilt, 0deg)); }
  to { opacity: 1; transform: none; }
}

/* ---- flagship: ippiClock ------------------------------------------------ */

.flagship {
  max-width: var(--measure);
  margin: clamp(2.75rem, 6vw, 4.25rem) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  border-top: 1px solid rgba(242, 242, 242, 0.14);
  padding: clamp(2.5rem, 5vw, 3.5rem) 0 clamp(3rem, 6vw, 4.5rem);
}

.app-id { display: flex; align-items: center; gap: 1.1rem; }
.app-icon {
  width: 4.75rem; height: 4.75rem; flex: none; border-radius: 1.05rem;
  box-shadow: 0 0 0 1px rgba(242, 242, 242, 0.14), 0 0.75rem 1.5rem -0.75rem rgba(0, 0, 0, 0.5);
}
.flagship h2 {
  margin: 0;
  font-weight: 300;
  font-size: clamp(2.1rem, 4.4vw, 2.9rem);
  line-height: 1.05;
  color: var(--white);
}
.app-kind { margin: 0.35rem 0 0; color: var(--night-muted); font-size: 0.98rem; }
.app-desc { margin: 1.6rem 0 0; max-width: 34rem; font-size: 1.15rem; line-height: 1.55; color: var(--white); }

.facts { list-style: none; margin: 1.25rem 0 0; padding: 0; max-width: 34rem; }
.facts li { position: relative; padding-left: 1.4rem; margin-top: 0.45rem; }
.facts li::before {
  content: ""; position: absolute; left: 0.1rem; top: 0.62em;
  width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--amber);
}

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.4rem; margin-top: 2rem; }
.soon { margin: 0; color: var(--night-muted); font-size: 0.95rem; }

/* The phone, on its side, with the clock's own light spilling out.
   On wide screens it hangs over the edge of the night band. */
.flagship-shot { position: relative; transform: translateY(clamp(3rem, 7vw, 6.5rem)); }
.device {
  margin: 0;
  padding: clamp(0.5rem, 1.3vw, 0.85rem) clamp(0.8rem, 2vw, 1.3rem);
  border-radius: clamp(1.2rem, 3vw, 2.1rem);
  background: #06080D;
  box-shadow:
    inset 0 0 0 1px rgba(242, 242, 242, 0.1),
    0 2.5rem 4rem -2rem rgba(4, 8, 18, 0.6),
    0 0 6rem -1rem rgba(232, 161, 90, 0.2);
  transition: box-shadow 0.5s ease;
}
.screen {
  overflow: hidden;
  border-radius: clamp(0.4rem, 1vw, 0.8rem);
  background: #000;
  aspect-ratio: 16 / 9;
}
.screen img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot-amber { animation: screen-on 1.6s ease-out 0.8s both; }
.shot-red { display: none; }
@keyframes screen-on {
  from { opacity: 0; filter: brightness(2) saturate(0.3); }
  35% { opacity: 1; }
  to { opacity: 1; filter: none; }
}

.screen-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
#screen-red:checked ~ .device .shot-amber { display: none; }
#screen-red:checked ~ .device .shot-red { display: block; animation: fade 0.45s ease both; }
#screen-red:checked ~ .device {
  box-shadow:
    inset 0 0 0 1px rgba(242, 242, 242, 0.1),
    0 2.5rem 4rem -2rem rgba(4, 8, 18, 0.6),
    0 0 6rem -1rem rgba(210, 30, 30, 0.2);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.screen-modes {
  display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end;
  margin: 0 0 0.9rem; padding: 0; border: 0; min-width: 0;
}
.screen-modes label {
  cursor: pointer;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--night-text);
  border: 1px solid rgba(242, 242, 242, 0.2);
}
.screen-modes label:hover { color: var(--white); border-color: rgba(242, 242, 242, 0.45); }
#screen-amber:checked ~ .screen-modes label[for="screen-amber"] {
  color: var(--navy); background: var(--amber); border-color: var(--amber);
}
#screen-red:checked ~ .screen-modes label[for="screen-red"] {
  color: #fff; background: #9A1F1F; border-color: #9A1F1F;
}
#screen-amber:focus-visible ~ .screen-modes label[for="screen-amber"],
#screen-red:focus-visible ~ .screen-modes label[for="screen-red"] {
  outline: 2px solid var(--white); outline-offset: 3px;
}

/* ---- buttons ----------------------------------------------------------- */

.button {
  display: inline-block;
  font: 500 1rem/1.2 var(--sans);
  text-decoration: none;
  color: var(--navy);
  background: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 0.7rem 1.35rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.button:hover { background: #F0B77C; }
.button:disabled { opacity: 0.6; cursor: wait; }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.button.quiet:hover { border-color: var(--focus); }
.night .button:focus-visible { outline-color: var(--white); }

.link {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--link); text-decoration: underline; text-underline-offset: 0.2em;
}

/* ---- the rest of the work ------------------------------------------------ */

.more { padding: clamp(5rem, 9vw, 8rem) var(--gutter) clamp(3rem, 6vw, 5rem); }
.more-inner { max-width: var(--measure); margin: 0 auto; }
.more h2 {
  margin: 0;
  font-weight: 300;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
  color: var(--ink);
}
.more-lede { margin: 0.5rem 0 0; color: var(--muted); }

.group {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem 2.5rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.group h3 {
  margin: 0;
  padding-top: 0.75rem;
  font-weight: 300;
  font-size: 1.45rem;
  line-height: 1.25;
  color: var(--ink);
}

.projects {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0.5rem 2.5rem;
}
.project {
  position: relative;
  padding: 0.85rem 0 1rem;
  border-top: 2px solid var(--line);
}
.project:hover { border-top-color: var(--focus); }
.project-name {
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--ink);
  text-decoration: none;
}
.project-name::after { content: ""; position: absolute; inset: 0; }
.project-name:hover { text-decoration: underline; text-decoration-color: var(--focus); }
.project-name:focus-visible { outline: none; }
.project-name:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.host { display: block; font-size: 0.85rem; color: var(--muted); }
.project p { margin: 0.45rem 0 0; max-width: 34rem; font-size: 0.98rem; line-height: 1.55; }
.project .tags { margin-top: 0.55rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  display: inline-block;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.private { color: var(--warm); border-color: currentColor; }
.night .tag.private { color: var(--amber); }

/* ---- other pages: slim navy header ------------------------------------- */

.site-head { background: var(--navy); padding: 1rem var(--gutter) 1.1rem; }
.site-home {
  display: flex; align-items: flex-end; gap: 1.1rem; flex-wrap: wrap;
  max-width: var(--measure); margin: 0 auto;
  color: var(--white); text-decoration: none;
}
.site-home .wordmark { width: 4.4rem; }
.site-tagline { font-weight: 300; font-size: 0.95rem; color: var(--night-text); padding-bottom: 0.2rem; }
.site-home:hover .site-tagline { color: var(--white); }
.site-head .site-home:focus-visible { outline-color: var(--amber); outline-offset: 6px; }

.page {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 3rem;
  flex: 1 0 auto;
}
.page > * { max-width: 42rem; }
.page.narrow > * { max-width: 34rem; }
.page.wide > * { max-width: 60rem; }
.page h1 {
  margin: 0 0 1rem;
  font-weight: 300;
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1.1;
  color: var(--ink);
}
.page h2 { margin: 2.25rem 0 0.4rem; font-weight: 400; font-size: 1.35rem; line-height: 1.3; color: var(--ink); }
.page p { max-width: 40rem; }
.status { min-height: 1.6em; color: var(--muted); }

.stack { margin-top: 1.5rem; }
.stack label { display: block; font-weight: 500; color: var(--ink); margin-bottom: 0.3rem; }

input[type=text], input:not([type]), input[type=url], select {
  display: block; width: 100%;
  font: 400 1rem/1.4 var(--sans);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  min-height: 2.6rem;
}
input:focus-visible, select:focus-visible { outline-offset: 1px; border-color: var(--focus); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--crust); margin: 0; }

/* ---- footer ------------------------------------------------------------ */

.site-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 1.75rem var(--gutter) 2.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.foot-inner { max-width: var(--measure); margin: 0 auto; }
.site-foot p { margin: 0.25rem 0; }

/* ---- owner bar and admin ----------------------------------------------- */

.owner-bar {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; align-items: center;
  padding: 0.55rem max(var(--gutter), calc((100% - var(--measure)) / 2));
  background: var(--navy-deep);
  color: var(--night-text);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(242, 242, 242, 0.1);
}
.owner-bar span { margin-right: auto; }
.owner-bar a, .owner-bar .link { color: var(--amber); }
.owner-bar form { margin: 0; }
.owner-bar :focus-visible { outline-color: var(--amber); }

.admin section + section { margin-top: 3rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.admin h2 { margin-top: 1.5rem; }
.hint { color: var(--muted); font-size: 0.95rem; max-width: 60ch; }
.saved, .newlink {
  border-left: 3px solid var(--focus);
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
.newlink code { word-break: break-all; }
.admin .group-head { margin: 2rem 0 0.4rem; font-weight: 300; font-size: 1.35rem; color: var(--ink); }
.project-form, .groups-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem 0.9rem;
  margin: 0.75rem 0;
  background: var(--surface);
}
.project-form.is-private { border-left: 4px solid var(--warm); }
.project-form.add { border-style: dashed; margin-top: 2rem; }
.project-form h3 { margin: 0 0 0.5rem; font-weight: 400; font-size: 1.15rem; color: var(--ink); }
.admin label { display: block; font-size: 0.83rem; color: var(--muted); margin: 0.3rem 0; flex: 1 1 14rem; }
.admin label.short { flex: 0 0 5.5rem; }
.admin label.check {
  flex: 0 0 auto; display: flex; gap: 0.45rem; align-items: center;
  color: var(--text); font-size: 0.93rem; align-self: end; padding-bottom: 0.5rem;
}
.admin input, .admin select { margin-top: 0.2rem; }
.admin input[type=checkbox] { margin-top: 0; }
.admin .row { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.admin .button { padding: 0.5rem 1.1rem; font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: center; margin-top: 0.6rem; }
.actions label.check { padding-bottom: 0; }
.keys { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.keys li { display: flex; gap: 1rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.keys form { margin: 0 0 0 auto; }

/* ---- smaller screens ---------------------------------------------------- */

@media (max-width: 52rem) {
  .flagship { grid-template-columns: minmax(0, 1fr); }
  .flagship-shot { transform: none; }
  .more { padding-top: clamp(3rem, 8vw, 4.5rem); }
  .group { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .group h3 { padding-top: 0; }
}

@media (max-width: 30rem) {
  .masthead-mark { width: 62vw; }
  .app-icon { width: 3.75rem; height: 3.75rem; border-radius: 0.85rem; }
  .site-tagline { display: none; }
  .screen-modes { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
