/* ---------------------------------------------------------------------------
   IDEES — Portal Aplicații
   Palette is sampled straight from the school logo (idees.ro): the ink of the
   wordmark plus the three roof strokes — blue, gold, red.
   --------------------------------------------------------------------------- */

:root {
  --ink:        #1a1818;
  --blue:       #004b9c;
  --gold:       #ffbe00;
  --red:        #cf001c;

  --blue-dark:  #003a78;
  --blue-tint:  #eef4fb;

  --text:       #1a1818;
  --text-muted: #5c6470;
  --text-soft:  #7b838f;

  --surface:    #ffffff;
  --bg:         #f6f7f9;
  --line:       #e5e8ec;
  --line-soft:  #eef0f3;

  --shadow-sm:  0 1px 2px rgba(26, 24, 24, .05);
  --shadow-md:  0 4px 16px rgba(26, 24, 24, .07);
  --shadow-lg:  0 16px 40px rgba(26, 24, 24, .11);

  --radius:     14px;
  --radius-sm:  10px;
  --wrap:       1120px;
  --ease:       cubic-bezier(.22, .61, .36, 1);

  --font-head:  "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body:  "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; font-weight: 700; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico { width: 24px; height: 24px; flex: none; }
.ico-sm { width: 17px; height: 17px; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--blue); color: #fff;
  padding: 10px 18px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600; font-size: .9rem;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 0; }

/* The logo's three roof strokes, flattened into a hairline rule. Used as the
   header/footer edge so the brand reads even without the mark in view. */
.flag-rule {
  height: 3px;
  background: linear-gradient(90deg,
    var(--ink)  0%,  var(--ink)  25%,
    var(--red)  25%, var(--red)  50%,
    var(--gold) 50%, var(--gold) 75%,
    var(--blue) 75%, var(--blue) 100%);
}

/* --- header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
}

.brand { display: inline-flex; align-items: center; gap: 14px; }
.brand-logo { width: 46px; height: auto; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: .14em;
  color: var(--ink);
}

.brand-sub {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .03em;
  color: var(--text-soft);
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.header-nav a:hover { color: var(--blue); border-color: #c8d7e8; transform: translateY(-1px); }

/* --- hero ----------------------------------------------------------------- */

.hero {
  padding: clamp(48px, 8vw, 88px) 0 clamp(28px, 4vw, 44px);
  background:
    radial-gradient(900px 380px at 12% -10%, var(--blue-tint), transparent 65%),
    radial-gradient(720px 320px at 92% 0%, #fff8e6, transparent 60%);
}

.eyebrow {
  font-family: var(--font-head);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  letter-spacing: -.02em;
  max-width: 20ch;
  margin-bottom: 18px;
  text-wrap: balance;
}

/* "într-un" must not break at its hyphen. */
.nb { white-space: nowrap; }

.lede {
  max-width: 60ch;
  font-size: clamp(1rem, 1.4vw, 1.09rem);
  color: var(--text-muted);
}

/* --- search --------------------------------------------------------------- */

.search {
  position: relative;
  margin-top: 30px;
  max-width: 420px;
}

.search-ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
  transition: color .18s var(--ease);
}

.search input {
  width: 100%;
  font: inherit;
  font-size: .96rem;
  color: var(--text);
  padding: 13px 18px 13px 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search input::placeholder { color: var(--text-soft); }
.search input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 75, 156, .13);
}
.search:focus-within .search-ico { color: var(--blue); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

/* --- section -------------------------------------------------------------- */

.apps { padding-bottom: clamp(56px, 8vw, 96px); flex: 1; }

.section-title {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-bottom: 14px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

/* --- cards ---------------------------------------------------------------- */

.card { display: flex; }
.card[hidden] { display: none; }

.card-link {
  --accent: var(--blue);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}

.card[data-accent="blue"] .card-link { --accent: var(--blue); }
.card[data-accent="gold"] .card-link { --accent: var(--gold); }
.card[data-accent="red"]  .card-link { --accent: var(--red);  }

/* Accent hairline along the top edge, revealed on hover. */
.card-link::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}

.card-link:hover,
.card-link:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #d9dee5;
}
.card-link:hover::before,
.card-link:focus-visible::before { transform: scaleX(1); }

.card-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  transition: transform .22s var(--ease);
}
.card-link:hover .card-icon { transform: scale(1.06) rotate(-3deg); }

.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.card-title {
  font-family: var(--font-head);
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}

.card-desc {
  font-size: .93rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
}
.card-cta .ico { transition: transform .22s var(--ease); }
.card-link:hover .card-cta .ico { transform: translateX(4px); }

/* Gold on white fails contrast as text — darken just the label. */
.card[data-accent="gold"] .card-cta { color: #8a6600; }

.empty {
  padding: 48px 0;
  text-align: center;
  color: var(--text-soft);
}

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

.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer .flag-rule { display: none; }

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-block: 26px;
  font-size: .87rem;
  color: var(--text-soft);
}
.footer-inner a { font-weight: 600; color: var(--text-muted); }
.footer-inner a:hover { color: var(--blue); }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap { padding-inline: 18px; }
  .grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .footer-inner { justify-content: center; text-align: center; }
}

/* --- dark mode ------------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
  :root {
    --text:       #eceef1;
    --text-muted: #a4acb8;
    --text-soft:  #848d9a;

    --surface:    #191c21;
    --bg:         #101215;
    --line:       #2a2f37;
    --line-soft:  #23272e;
    --blue-tint:  #10233a;

    --shadow-sm:  0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, .45);
    --shadow-lg:  0 16px 40px rgba(0, 0, 0, .55);
  }

  .site-header { background: rgba(25, 28, 33, .85); }
  .brand-name { color: var(--text); }
  .brand-logo { filter: brightness(0) invert(1); }
  .card-title { color: var(--text); }
  .eyebrow { color: #6ea8e8; }

  .hero {
    background:
      radial-gradient(900px 380px at 12% -10%, #13253c, transparent 65%),
      radial-gradient(720px 320px at 92% 0%, #2a2413, transparent 60%);
  }

  .card[data-accent="blue"] .card-link { --accent: #5a9ee0; }
  .card[data-accent="red"]  .card-link { --accent: #ef5568; }
  .card[data-accent="gold"] .card-cta  { color: var(--gold); }

  .card-link:hover, .card-link:focus-visible { border-color: #3a4049; }
  .search input:focus { box-shadow: 0 0 0 4px rgba(90, 158, 224, .18); }
}

/* --- motion --------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .5s var(--ease) backwards; }
  .card:nth-child(1) { animation-delay: .02s; }
  .card:nth-child(2) { animation-delay: .06s; }
  .card:nth-child(3) { animation-delay: .10s; }
  .card:nth-child(4) { animation-delay: .14s; }
  .card:nth-child(5) { animation-delay: .18s; }
  .card:nth-child(6) { animation-delay: .22s; }
  .card:nth-child(7) { animation-delay: .26s; }

  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }
}

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